Let's get started quickly Now, when you run
php artisan make:controller UserController --resource --model=User --requests
it will generate two FormRequest classes: StoreUserRequest
and UpdateUserRequest
, and will replace them in the Controller.
A short version of --requests
flag is -R
, not to mix with -r
for resources.
It is done by reusing the make:request
command and calling it with appropriate class name.
This functionality works only together with --model
flag, otherwise it would be impossible/hard to guess the name for the FormRequest classes.
Also, it works one "layer" above in the Model:
php artisan make:model Project -mcrR
would generate StoreProjectRequest
and UpdateProjectRequest
I hope you enjoy the code.
Top comments (0)