I am using Laravel 4.2. While using make
method of Response
class i am getting undefined method error.
Route::get('/', function()
{
$contents = "Hello";
$response = Response::make($contents, 200);
return $response;
});
Here is the error
The error is absolutely correct.. make
doesn't exist in the Http
class, it exists as an accessor method off of the Facade
class.
use Illuminate\Support\Facades\Response;
If you (for some reason) need both, just alias it.
use Illuminate\Support\Facades\Response as FacadeResponse;
Then you can just do $response = FacadeResponse::make($content, 200);
Have a gander at the docs for more information.
The simple thing I did for this problem
return \Response::stream($callback, 200, $headers);
I put forward slash ( \ ) before Response.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With