
This Laravel CRUD Generator package provides and generates Controller, Model (with eloquent relations), Migration, Routes and Views for developing your applications with a single command.
Automatically generates files in the proper directory structure:
Interactive prompts for input:
Product, User).Provides options for:
Automatically propagates updates:
$fillable property in models.Controller creation:
Route creation:
web.php or api.php.View file generation:
Laravel >= 8.x
PHP >= 7.4
1 - Install
composer require codebider/generate-crud
2- Publish the default package's config
php artisan vendor:publish --tag=crud-generator-config
This tool can create the files by typing the command
php artisan generate:crud
Model Name:
Product, Category). Follow Laravel's naming conventions (singular and CamelCase).
Enter the model name:
Field Names and Types:
Enter field name (or press enter to stop adding fields):
Example:
Enter field name (or press enter to stop adding fields):
> name
Select field type by default (string):
[0 ] string
[1 ] text
[2 ] longText
[3 ] integer
[4 ] unsignedIn
[5 ] bigInteger
[6 ] unsignedBi
[7 ] json
[8 ] jsonb
[9 ] enum
[10] decimal
[11] float
[12] ipAddress
[13] boolean
[14] date
[15] datetime
[16] timestamp
> 0
Nullable [Yes]:
[0] Yes
[1] No
> 0
Enter field name (or press enter to stop adding fields):
>
Creating Migration File
Updating Migration File
fields are : name
Preview Migration File:
Do you want to review the migration file before proceeding? (yes/no) [yes]:
> yes
Opening migration file: G:\laragon\www\Expense\database\migrations/Api/2024_12_29_105049_create_products_table.php
Edit Migration File:
config/crud_generator.php).Propagating Changes:
$fillable in models).
Is the migration file correct? (yes/no) [yes]:
> yes
Migration file is correct.
Migrated Successfully.
Creating Model
Adding Relationships:
Do you want to add relationships to this model? [No]:
[0] Yes
[1] No
> 0
Creating a Controller:
Do you want to generate Controller? [Yes]:
[0] Yes
[1] No
>
Do you want to create a resource controller or a basic controller? [resource]:
[0] resource
[1] basic
>
Resource controller created successfully at G:\laragon\www\Expense\app\Http\Controllers\Api\ProductController.php
Generating Routes:
web.php or api.php based on your application requirements.
Where do you want to add routes? [web.php]:
[0] api.php
[1] web.php
>
Generating web routes...
Added route to G:\laragon\www\Expense\routes/web.php
Creating View Files:
Do you want to generate views? [Yes]:
[0] Yes
[1] No
>
Generating views...
Created view file: G:\laragon\www\Expense\resources\views\Api\products/index.blade.php
Successfully created the crud
Migration and cache cleared successfully!
CRUD files for Product generated successfully!
Log sent to server successfully.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Awais Javaid Email Me
Hire Me LinkedIn
How can I help you explore Laravel packages today?