1140 0 0 0
Last Updated : 2025-04-28 23:52:13
This command creates a new controller file in app/Http/Controllers folder in laravel with all available parameters
Example usage:
php artisan make:controller PostController
Parameters:
--resource
The controller will contain a method for each of the available resource operations – index(), create(), store(), show(), edit(), update(), destroy()
--api
Similar to –resource above, but generate only 5 methods: index(), store(), show(), update(), destroy(). Because create/edit forms are not needed for API.
--invokable
Generates controller with one __invoke() method
--model=Photo
If you are using route model binding and would like the resource controller’s methods to type-hint a model instance.