increments('id'); $table->string('name'); $table->timestamps(); }); Schema::create('photo_labels', function ($table) { $table->unsignedBigInteger('photo_id'); $table->unsignedInteger('label_id'); $table->foreign('photo_id') ->references('id')->on('photos') ->onDelete('cascade'); $table->foreign('label_id') ->references('id')->on('labels') ->onDelete('cascade'); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('photo_labels'); Schema::dropIfExists('labels'); } }