With Laravel 5 it seems like method injection for the Request object is preferred over using the Request facade.
<?php namespace App\Http\Controllers;
use Illuminate\Http\Request;
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 Illuminate\Http\Request
better than using Illuminate\Support\Facades\Request
I have no idea how $request->get() is resolving as there is no function name get()
in Illuminate\Http\Request
. input() and get() does the same thing.
Is method injection better than using Facades?