foreign('user_id')->references('id')->on('users')->onDelete('cascade'); }); Schema::table('replies', function (Blueprint $table) { $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); $table->foreign('topic_id')->references('id')->on('topics')->onDelete('cascade'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('topics', function (Blueprint $table) { $table->dropForeign(['user_id']); }); Schema::table('replies', function (Blueprint $table) { $table->dropForeign(['user_id', 'topic_id']); }); } }