id(); $table->string('title_ru'); $table->string('title_en'); $table->timestamps(); }); // test seed for ($i = 2020; $i < 2026; $i++) { Season::create([ 'title_ru' => $i . ' год', 'title_en' => $i . ' year', ]); } Schema::create('player_season', function (Blueprint $table) { $table->id(); $table->foreignIdFor(Season::class) ->constrained() ->onUpdate('cascade') ->onDelete('restrict'); $table->foreignIdFor(Player::class) ->constrained() ->onUpdate('cascade') ->onDelete('restrict'); $table->unique(['season_id', 'player_id']); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('player_season'); Schema::dropIfExists('seasons'); } };