Laravel 5 CRUD Generator Example


If you are laravel expert developer then you must choose something tools for crud generator in laravel 5 app. in this tutorial I will show you how to generate crud module using InfyOm CRUD Generator package. using InfyOm package you can simply create admin panel with crud generator.

As I write above, if you expert in laravel then you should use something amazing for generate crud module for your admin panel. like if you run just simple one command and generate insert updated delete module in your admin panel, also you can reset admin panel theme easily, as well as easily update the theme. so let's use InfyOm package that will help to make better coding and quick crud generator.

You can see full and simple example of generate "products" crud module using InfyOm package. After end of this tutorial you will get layout like as bellow screen shot.

Layout:

Step 1: Install Packages

first of all we will install packages, we need to install infyomlabs/laravel-generator, laravelcollective/html, and infyomlabs/adminlte-templates packages. So let's run bellow command for install three packages.

composer require infyomlabs/laravel-generator:"5.5.x-dev"

composer require laravelcollective/html

composer require infyomlabs/adminlte-templates:"5.5.x-dev"

After successfully install packages, open config/app.php file and add service provider and alias.

config/app.php

'providers' => [

....

Collective\Html\HtmlServiceProvider::class,

Laracasts\Flash\FlashServiceProvider::class,

Prettus\Repository\Providers\RepositoryServiceProvider::class,

\InfyOm\Generator\InfyOmGeneratorServiceProvider::class,

\InfyOm\AdminLTETemplates\AdminLTETemplatesServiceProvider::class,

],

'aliases' => [

....

'Form' => Collective\Html\FormFacade::class,

'Html' => Collective\Html\HtmlFacade::class,

'Flash' => Laracasts\Flash\Flash::class,

]

Step 2: Publish Packages

In second step, we will publish configuration of above installed three packages. So you have to simple run one by one command and publish layout, configuration and controller.

Publish Configuration Files:

php artisan vendor:publish

Publish Layout Files:

php artisan infyom.publish:layout

Publish Controller Files:

php artisan infyom:publish

Step 3: Generate CRUD

In last step, we will generate "products" crud module using command, so here is simple example for crud generator, i also attach screen shot for crud generate.

Product Module

php artisan infyom:scaffold Product

Field: (name db_type html_type options) []:

> name string text

Enter validations: []:

> required

Field: (name db_type html_type options) []:

> body text textarea s,ii

Enter validations: []:

> required

Field: (name db_type html_type options) []:

> exit

....

Do you want to migrate database? [y|N] (yes/no) [no]:

> yes

You can use and see. you can get more information from here : http://labs.infyom.com/laravelgenerator

I hope you found your best....


January 23, 2018 | 5805 Viewer | Category : PHP Laravel Bootstrap Laravel 5 Laravel 5.5
Related Posts