Laravel CRUD Generator cover image

Laravel CRUD Generator

Mehrad Sadeghi • July 31, 2022

Laravel CRUD Generator is a simple and light-weight wrapper on Laravel’s default controller generator, Which makes creating a controller with a pre-defined CRUD like a breeze.

You can define your validation rules in an interactive way that crud-generator provides. Also it is compatible with Laravel 5.x, 6.x, 7.x, 8.x and 9.x.

Installation

$ composer require mehradsadeghi/laravel-crud-generator Usage

It works based on your $fillable property of the target model.

If you would like to use $guarded instead of $fillable, It is supported too. In that case you'll need to have an existing Schema (table), Then the crud generator will automatically figures out your fillables.

As an example:

$ php artisan make:crud UserController --model=User If you would like to have validation rules too, You may enter the --validation option:

$ php artisan make:crud UserController --model=User --validation

Laravel CRUD Generator Show Sample

Customizing Default Stubs

It is possible to publish default stubs and change them in a way that fulfills your requirements.

In order to do this:

$ php artisan crud:publish

The published stubs will be located within stubs/crud directory in the root of your application. Any changes you make to these stubs will be reflected when you generate crud.

Feel free to take a look at crud-generator repository.