Answer the question
In order to leave comments, you need to log in
Can't deal with migrations in Laravel?
Just getting acquainted with the framework and I don’t understand why the migration does not work?
For example, I wanted to create 2 tables posts and categories based on the example from the
post table documentation
$table->string('title');
$table->text('content');
$table->unsignedBigInteger('category_id')->nullable();
$table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');
$table->string('title');
Answer the question
In order to leave comments, you need to log in
it turns out I can't create the post table because there is no categories table yetIt turns out.
you need to create a separate migrationNecessary. Or just add keys after creating tables in the same migration. But, fortunately, such a need arises about once in never.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question