Appearance
Generator GUI Interface
Generator also comes with visual GUI interface builder which can be used to generate code from GUI interface. Its add-on extension which can be installed optionally.
With this interface, you can specify the fields you want in your models and with all options of swagger, test cases, soft delete etc. and then generates the exact same files which are generated from the command line.
Also, You can put builder on your choice of route and with middleware, so your application can be secure.
Installation
Note: Make sure, you have InfyOm Laravel Generator already installed before you proceed with this installation. If not then first go for it. You can find installation steps here.
Add Package
- Add following package into your
composer.json
.
sh
"require": {
"infyomlabs/generator-builder": "^1.0"
}
Composer Update
After adding packages, run the following command:
composer update
Add Service Provider
Add the following service provider into your providers array in config/app.php
sh
InfyOm\GeneratorBuilder\GeneratorBuilderServiceProvider::class,
Run Publish Command
Run publish command for builder to generate config file,
php artisan vendor:publish
It will create config/infyom/generator_builder.php
in which views for the generator is specified.
Run routes Publish Command
Run publish command for builder to generate config file,
php artisan infyom.publish:generator-builder
It will publish following routes in routes.php
.
sh
Route::get('generator_builder', '\InfyOm\GeneratorBuilder\Controllers\GeneratorBuilderController@builder')
->name('io_generator_builder');
Route::get('field_template', '\InfyOm\GeneratorBuilder\Controllers\GeneratorBuilderController@fieldTemplate')
->name('io_field_template');
Route::get('relation_field_template', '\InfyOm\GeneratorBuilder\Controllers\GeneratorBuilderController@relationFieldTemplate')
->name('io_relation_field_template');
Route::post('generator_builder/generate', '\InfyOm\GeneratorBuilder\Controllers\GeneratorBuilderController@generate')
->name('io_generator_builder_generate');
Route::post('generator_builder/rollback', '\InfyOm\GeneratorBuilder\Controllers\GeneratorBuilderController@rollback')
->name('io_generator_builder_rollback');
Route::post('generator_builder/generate-from-file','\InfyOm\GeneratorBuilder\Controllers\GeneratorBuilderController@generateFromFile')
->name('io_generator_builder_generate_from_file');
You can customize it your own way and put it in secure middleware as well with whatever permission level you want. Generator Builder will be opened on this routes.
Open /generator_builder
URL on your server or whatever customized routes you have placed.
Customization
You can also customize the view of generator builder and apply your theme and layout.
BUT MAKE SURE YOU DON'T MODIFY OR REMOVE ANY JS FILE OR FIELD, OTHERWISE BUILDER WILL NOT WORK PROPERLY.
To do that, run a publish command with views option,
php artisan infyom.publish:generator-builder --views
It will publish views in resources/views/infyom/generator-builder/
directory.
After that, change config file config/infyom/generator_builder.php
.
There are two views which are used in builder,
Main builder view,
change 'builder' => 'generator-builder::builder'
to 'builder' => 'infyom.generator-builder.builder'
Field Template view,
change 'field-template' => 'generator-builder::field-template'
to 'field-template' => 'infyom.generator-builder.field-template'