0

What is the difference between

use Illuminate\Http\Request;
use App\Http\Requests;

? Both look like same and how do their differ in working ?

Naveen Kumar
  • 1,476
  • 5
  • 28
  • 52

1 Answers1

1

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.

Thomas De Marez
  • 668
  • 8
  • 24