What is the difference between
use Illuminate\Http\Request;
use App\Http\Requests;
? Both look like same and how do their differ in working ?
What is the difference between
use Illuminate\Http\Request;
use App\Http\Requests;
? Both look like same and how do their differ in working ?
Illuminate\Http\Request
is used in a controller to handle an incoming request (GET
, POST
, PUT
, PATCH
, ...) and even more it's explained beautifully in the docs.
App\Http\Requests
is the parent namespace used for form validation rules, this allows you to keep your controller clean and write the validation rules for an incoming request in a separate class. It also makes your validation class reusable for other controllers. Again nicely documented here.