Ad

How To Create Laravel Model From Migration?

I found many results how to create migration from a model, but is there any way to create a model from migrations?

Basically I want to give a table name, and if there is multiple migration files (one to create and others to update the previous states) the model could be updated.

Is there any solution for this?

Ad

Answer

I'm not sure that there's a good way to create a model directly from migrations, as it depends on what database you use as to the exact structure of your tables.

There seems to be a package which support generating the models from your database, however: https://github.com/laracademy/generators

Ad
source: stackoverflow.com
Ad