Laravel

Page Contents

Table naming convention: plural
Model naming convention: singular with capitalize

create controller with model and resource in single artisan command

php artisan make:controller YourController -mr

Options:
–api Exclude the create and edit methods from the controller
–type=TYPE Manually specify the controller stub file to use
–force Create the class even if the controller already exists
-i, –invokable Generate a single method, invokable controller class
-m, –model[=MODEL] Generate a resource controller for the given model
-p, –parent[=PARENT] Generate a nested resource controller class
-r, –resource Generate a resource controller class
-R, –requests Generate FormRequest classes for store and update
-s, –singleton Generate a singleton resource controller class
–creatable Indicate that a singleton resource should be creatable
–test Generate an accompanying PHPUnit test for the Controller
–pest Generate an accompanying Pest test for the Controller
-h, –help Display help for the given command. When no command is given display help for the list command
-q, –quiet Do not output any message
-V, –version Display this application version
–ansi|–no-ansi Force (or disable –no-ansi) ANSI output
-n, –no-interaction Do not ask any interactive question
–env[=ENV] The environment the command should run under
-v|vv|vvv, –verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

create model with controller, factory, migration, seed and resource in single artisan command

php artisan make:model ModelName -cfms

Options:
-a, –all Generate a migration, seeder, factory, policy, resource controller, and form request classes for the model
-c, –controller Create a new controller for the model
-f, –factory Create a new factory for the model
–force Create the class even if the model already exists
-m, –migration Create a new migration file for the model
–morph-pivot Indicates if the generated model should be a custom polymorphic intermediate table model
–policy Create a new policy for the model
-s, –seed Create a new seeder for the model
-p, –pivot Indicates if the generated model should be a custom intermediate table model
-r, –resource Indicates if the generated controller should be a resource controller
–api Indicates if the generated controller should be an API resource controller
-R, –requests Create new form request classes and use them in the resource controller
–test Generate an accompanying PHPUnit test for the Model
–pest Generate an accompanying Pest test for the Model
-h, –help Display help for the given command. When no command is given display help for the list command
-q, –quiet Do not output any message
-V, –version Display this application version
–ansi|–no-ansi Force (or disable –no-ansi) ANSI output
-n, –no-interaction Do not ask any interactive question
–env[=ENV] The environment the command should run under
-v|vv|vvv, –verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug