I'm familiar with the laravel artisan command
make:request
however I can't seem to get it to place it in a directory. For example I have a directory structure
app/Http/Requests/User
and I'd like to place a request in that folder namespaced appropriately but
php artisan make:request User\CreateUserRequest
doesn't work.
In Laravel, you can fetch the request input data by using $request->all(). This will then return the input data as an array.
input() is a method of the Laravel Request class that is extending Symfony Request class, and it supports dot notation to access nested data (like $name = $request->input('products.0.name') ).
The “path” method is used to retrieve the requested URI. The is method is used to retrieve the requested URI which matches the particular pattern specified in the argument of the method. To get the full URL, we can use the url method.
artisan make:request User\\CreateUserRequest
thanks to @DarrylCoder for answering in the comments
php artisan make:request Auth\\CreateUserRequest
that will make request file in Requests\Auth
folder
OR
php artisan make:request Auth/CreateUserRequest
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With