What do you want to save?
Add Code snippet
New code examples
-
PHP 2021-11-12 12:30:14
comment = Comment::find($this->route('comment')); in laravel
Schema::create('comments', function (Blueprint $table) { $table->increments('id'); $table->integer('user_id')->unsigned(); $table->foreign('user_id')->references('id')->on('users')->onCascad... Add solution -
Other 2021-09-28 11:28:04
General error: 3780 Referencing column 'user_id' and referenced column 'id' in foreign key constraint 'blog_posts_user_id_foreign' are incompatible.
$table->bigInteger('user_id')->unsigned()->index(); $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); Add solution -
SQL 2021-09-18 18:27:03
SQLSTATE[HY000]: General error: 3780 Referencing column 'role_id' and referenced column 'id' in foreign key constraint 'user_role_id foreign' are incompatible.
As the name says the referenced foreign key and the id in the table are not of same type. Example : // user_id foreign key referenced table $table->bigInteger('user_id')->unsigned()->index(); $table->foreign('user_id')->references('id'... Add solution -
PHP 2021-09-01 00:03:02
laravel view not created using foreign keys
Schema::create('larachat_chat_rooms', function (Blueprint $table) { $table->increments('id'); //Foreign key must be unsignedBigInteger $table->unsignedBigInteger('creator_id'); $table->softDeletes(); $table-&... Add solution
Best helpers
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5