How to create a RESTful Resource Controller in Laravel 5.2?

Published on Author Code Father

Try getting help on the command

php artisan help make:controller

If you see a --resource flag in the help options you are probably on 5.2 and can add that flag to the command to get a resource controller.

php artisan make:controller --resource SomeResourceController

For Laravel 5.0 and 5.1 the make:controller command would make a resource controller by default and the --plain option would make a plain controller.

Laravel 5.2 – Restful Resource Controllers – Default plain

Laravel 5.1 – Restful Resource Controllers – Default resource

Laravel 5.0 – Restful Resource Controllers – Default resource

—————————————/OR/—————————————————

For Laravel 5.2

php artisan make:controller NameofController --resource
// It will create the controller with all methods.

If Laravel < 5.2

php artisan make:controller NameofController
// It will create the controller with all methods.

and

php artisan make:controller NameofController --plain
// It will create the controller without any method.

Comments

comments