Laravel Model/Migration Generator


This utility to help you create new Laravel models on the fly by just defining the model's schema and table name. After your definition in the corresponding fields, you will get a code snippet to copy and paste in the model and migration files.

First start by defining the models name and if it uses a single or compound key. After that go ahead and defined the desired attributes the model will have.

This is a work in progress. Enjoy!


1) Configuration


2) Fields

Name Type Key? Nullable? Fillable?
Length
Decimals


Copy the following code in your migration script and model class for the corresponding defined Laravel model.


Migration Code


If you haven't defined a migration for this new model, you can use the following artisan command: php artisan make:migration create_{{ tableNameLowerCase }}_table


{{ migrationCode }}

Model Class Code


If you haven't defined a model class for this new model, you can use the following artisan command: php artisan make:model {{ tableName }}


{{ modelClassCode }}