https://laravel.com/docs/9.x/controllers#specifying-the-resource-model
php artisan make:controller MyController --model MyModel --resource
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
We can easily generate or make a resource controller through php artisan make:controller ControllerName --resource command (notice, we embed --resource flag with the command). It generally created a resource route, to easily perform crud operations through route.
But, is there any persistent way to generate a Controller with automatic Model Binding that corresponds to the controller? e.g. Maybe I run a command like this php artisan make:controller --resource --bind and it will generate a controller with few methods like this,
use App\Models\MyModel;
public function edit(MyModel $mymodel) {
//
}
Is it really available in laravel or do I have to just manually typehint/inject the Model while working?
Let me know if you still didn't get my question. Thanks!
https://laravel.com/docs/9.x/controllers#specifying-the-resource-model
php artisan make:controller MyController --model MyModel --resource
Please or to participate in this conversation.