unsignedInteger('user_id'); $table->foreign('user_id', 'fk_users') ->references('id') ->on('users') ->onDelete('cascade'); $table->unsignedInteger('group_id'); $table->foreign('group_id', 'fk_groups') ->references('id') ->on('groups') ->onDelete('cascade'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('groups_users', function (Blueprint $table) { $table->dropForeign('fk_users'); $table->dropForeign('fk_groups'); }); Schema::dropIfExists('groups_users'); } }