From: Daniel Karbach Date: Sat, 12 Jul 2025 13:03:13 +0000 (+0200) Subject: store step ladder mode X-Git-Url: http://git.localhorst.tv/?a=commitdiff_plain;h=b44d89e240ec1bc45878e92289e206ee31428ba4;p=alttp.git store step ladder mode --- diff --git a/app/Console/Commands/SyncStepLadder.php b/app/Console/Commands/SyncStepLadder.php index b44b843..07afe81 100644 --- a/app/Console/Commands/SyncStepLadder.php +++ b/app/Console/Commands/SyncStepLadder.php @@ -71,6 +71,7 @@ class SyncStepLadder extends Command { } $mode = $this->getMode($ladderEntry); $episode->event()->associate($event); + $episode->stepLadderMode()->associate($mode); $episode->title = $mode->name; $episode->start = Carbon::createFromTimestamp($ladderEntry['time']); $episode->estimate = 2 * 60 * 60; diff --git a/app/Console/Commands/SyncStepLadderFull.php b/app/Console/Commands/SyncStepLadderFull.php index a81033f..6cef974 100644 --- a/app/Console/Commands/SyncStepLadderFull.php +++ b/app/Console/Commands/SyncStepLadderFull.php @@ -71,6 +71,7 @@ class SyncStepLadderFull extends Command { } $mode = $this->getMode($ladderEntry); $episode->event()->associate($event); + $episode->stepLadderMode()->associate($mode); $episode->title = $mode->name; $episode->start = Carbon::createFromFormat('Y-m-d H:i:s', $ladderEntry['time'], 'America/Detroit')->setTimezone('UTC'); $episode->estimate = 2 * 60 * 60; diff --git a/app/Models/Episode.php b/app/Models/Episode.php index 4eb8a57..df7c802 100644 --- a/app/Models/Episode.php +++ b/app/Models/Episode.php @@ -40,6 +40,10 @@ class Episode extends Model return $this->hasMany(EpisodePlayer::class); } + public function stepLadderMode() { + return $this->belongsTo(StepLadderMode::class); + } + public function getScheduledEventName(): string { $parts = []; if (count($this->players) == 4) { diff --git a/database/migrations/2025_07_12_124515_episode_ladder_mode.php b/database/migrations/2025_07_12_124515_episode_ladder_mode.php new file mode 100644 index 0000000..0ece256 --- /dev/null +++ b/database/migrations/2025_07_12_124515_episode_ladder_mode.php @@ -0,0 +1,26 @@ +foreignId('step_ladder_mode_id')->nullable()->default(null)->constrained(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void { + Schema::table('episodes', function (Blueprint $table) { + $table->dropColumn('step_ladder_mode_id'); + }); + } +};