What is the Laravel 5 equivelant for Laravel 4s?:
Response::json
Response::input
And what facade do I need to use?
Inject the ResponseFactory into your class/method:
<?php namespace App;
use Illuminate\Contracts\Routing\ResponseFactory;
class SomeClass {
protected $response;
public function __construct(ResponseFactory $response)
{
$this->response = $response;
}
public function someMethod()
{
return $this->response->json($data);
}
}
Or:
// This will only work if method is resolved by service container
public function someMethod(ResponseFactory $response)
{
return $response->json($data);
}
You can find a map of Laravel façades and what to type-hint instead at http://laravel.com/docs/master/facades#facade-class-reference
Alternative, you can still use façades, you just need to import them:
<?php namespace App;
use Response;
class SomeClass {
public function someMethod()
{
return Response::json($data);
}
}
But I’d recommend going the injecting-contracts routes. It’s just a better approach.