Ok, got it - an extra migration does the job :-)
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->foreign('group_id')->references('id')->on('groups');
});
Schema::table('groups', function (Blueprint $table) {
$table->foreign('user_id')->references('id')->on('users');
});
}
BUT! How do i insert such a thing? I have two table having foreign key on each other. I get the constraint violation the second i insert the date in one of the tables...
Is this possible at all?
Has some one any suggestion?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community