Level 55
@merrychristmas because your index method does not return the result
public function index(){
return $this->generateItBySomeOtherFunction();
}
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
This will return file with a content. Everything OK.
// SomeController.php
public function index(){
$stream = Storage::disk('public_folder')->readStream($this->filename);
return response()->stream(
function () use ($stream) {
fpassthru($stream);
},
200,
['Content-Type' => 'application/xml']
);
}
Code stays the same. But I will move it into another function. It will return empty file:
// SomeController.php
public function index(){
$this->generateItBySomeOtherFunction();
}
public function generateItBySomeOtherFunction(){
$stream = Storage::disk('public_folder')->readStream($this->filename);
return response()->stream(
function () use ($stream) {
fpassthru($stream);
},
200,
['Content-Type' => 'application/xml']
);
}
@merrychristmas because your index method does not return the result
public function index(){
return $this->generateItBySomeOtherFunction();
}
Please or to participate in this conversation.