Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 316
netdjw Avatar asked Oct 19 '25 12:10

netdjw


1 Answers

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

like image 169
atymic Avatar answered Oct 22 '25 05:10

atymic



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!