Installation of Laravel
First you need to install laravel by running below composer commands
composer create-project laravel/laravel example-app
After creating project run artisan command to initialize development server
cd example-app
php artisan serve
Now you can access your application in your web browser at http://localhost:8000
Installing Infyom laravel generator
Now you need to install laravel generator by infyom.
Add following packages into composer.json while using it with Laravel 9.
"require": {
"infyomlabs/laravel-generator" : "^5.0",
"infyomlabs/adminlte-templates" : "^5.0"
}
if you want to use Generate from table option, you need to install
"require": {
"doctrine/dbal" : "^2.3"
}
After saving changes in composer.json run following command
composer update
php artisan vendor:publish --provider="InfyOm\Generator\InfyOmGeneratorServiceProvider"
It will publish the configuration file config/laravel_generator.php
Now you need to publish generator stuff:
php artisan infyom:publish
This Generator provides various commands to generate scaffolds and APIs just by running commands:
php artisan infyom:api $MODEL_NAME
php artisan infyom:scaffold $MODEL_NAME
php artisan infyom:api_scaffold $MODEL_NAME
Generate from Table
The best part of this generator is you can generate any module by just creating database table and running below command.
php artisan infyom:scaffold Post --fromTable --table=posts
You will get whole post module with crud operation after running this command. You can generate more modules using this technique and save your time.
Comments
Post a Comment