When writing your migrations in Eloquent you may want to define something like 
 $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');

To do this (in version 6 of Laravel) you must define the foreign keys using the following syntax to match the new bigIncrements autoincrement key added by Laravel to all tables.

$table->unsignedBigInteger('user_id');

Last modified: 02/11/2020

Comments

Author

This works in earlier version like 5.8 too.

Write a Reply or Comment

Your email address will not be published.