Laravel - Model Generator Posted on April 27, 2016

I was looking for a model generator that would generate my models based on pre-existing database tables. I did find a couple however, they just never did exactly what I wanted.

Thus I created my own Model Generator and released it under the Laracademy github.

What is it?

Well this generator as I said above will take any table in your database and it will generate a model for you. Except this isn't any kids generator where they just give you a boiler plate and you have to fill in the rest. This generator will try it's best to figure out which columns are fillable, which columns are dates and which columns need to be casted as booleans, etc.

So what does that mean?

That means that you don't need to fill out most of your model any more! Instead of having the painful task of adding in all those fillable fields they will be generated from the database itself.

How do I get it?

The easiest way to get it is via composer

composer require "laracademy/model-generator"

You can read more about the information but visiting the Github Repository, or the Packagist listing.

Before I try this, do you have an example.

Yes we sure do, you can watch the quick video

Share this post