Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate laravel request in namespace path for laravel 5

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.

like image 765
matthewdaniel Avatar asked Oct 18 '14 13:10

matthewdaniel


People also ask

How can I get Laravel data request?

In Laravel, you can fetch the request input data by using $request->all(). This will then return the input data as an array.

What is request -> input () in Laravel?

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') ).

How can you retrieve the full URL for the incoming request in Laravel?

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.


2 Answers

artisan make:request User\\CreateUserRequest

thanks to @DarrylCoder for answering in the comments

like image 127
matthewdaniel Avatar answered Oct 02 '22 03:10

matthewdaniel


php artisan make:request Auth\\CreateUserRequest

that will make request file in Requests\Auth folder

OR

php artisan make:request Auth/CreateUserRequest

like image 36
im-sunil Avatar answered Oct 02 '22 03:10

im-sunil