Saloum45/ControllerGenerate is a Laravel package that makes it easy to dynamically generate controllers, migrations and routes in a Laravel application here the link.
complete tuto : Youtube
How it works 👉🏽👉🏽👉🏽👉🏽 😇NB😇: you must first create the models before installing the package, because the package is based on the models for generation.
Constraints 👉🏽👉🏽👉🏽👉🏽 😇NB😇: for foreign keys you must respect this naming : id_table_name example : id_classe.
Installation: Add the package to your Laravel project via Composer by running the following command:
composer require saloum45/controllergenerate
Configuration: The package service provider, PackageServiceProvider, is automatically registered during installation. This provider will create the necessary commands in the app/Console/Commands folder.
Order execution:
To generate the controllers, run the following command in your terminal:
php artisan generate:controllers
To generate routes, run:
php artisan generate:routes
To generate migrations, run:
php artisan generate:migrations
to migrer and seed, run :
php artisan migrate
Result: After the commands are executed, controllers with CRUD methods will be created in the app/Http/Controllers folder, migrations in the database/migrations folder and the corresponding routes will be added to your API routes file ...