With Laravel 5 it seems like method injection for the Request object is preferred over using the Request facade.
<?php namespace AppHttpControllers;
use IlluminateHttpRequest;
class HomeController extends Controller
{
public function index(Request $request)
{
$email = $request->input('email');
// OR
$email = $request->get('email');
}
}
A few questions I have:
Is using IlluminateHttpRequest
better than using IlluminateSupportFacadesRequest
I have no idea how $request->get() is resolving as there is no function name get()
in IlluminateHttpRequest
. input() and get() does the same thing.
Is method injection better than using Facades?
See Question&Answers more detail:os