p1rate_k1ng
p1rate_k1ng

Reputation: 1

Should i write migrations every time i want to create table in Laravel?

So basicly i have started working with laravel. And to this moment i have been writing migrations and defining the fields there. And after that i should create a model related to it and define the relationships there. Unlike the Django framework where you define fields and relationships inside a model and migrations created automaticly.

Thus my question is: Is there any other way of writing the migrations so that i don't need to write models as well. Or am i stuck with writing everything myself?

I have tried: php artisan make:model User -m in console, but it only creates the file and that's it

Would appreciate the sources if there are any

Upvotes: 0

Views: 79

Answers (1)

Toby Allen
Toby Allen

Reputation: 11211

Yes, you should write a migration for each table / model you wish to create.

If you create the migration, the model will automatically have all the correct fields as attributes.

Upvotes: 0

Related Questions