]> git.localhorst.tv Git - alttp.git/commitdiff
store step ladder mode
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Sat, 12 Jul 2025 13:03:13 +0000 (15:03 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Sat, 12 Jul 2025 13:03:13 +0000 (15:03 +0200)
app/Console/Commands/SyncStepLadder.php
app/Console/Commands/SyncStepLadderFull.php
app/Models/Episode.php
database/migrations/2025_07_12_124515_episode_ladder_mode.php [new file with mode: 0644]

index b44b843bfb8f9a90410dfc372c18001756cc3ee7..07afe81c8a3f530672f4b2a324e0c576c7bfcce5 100644 (file)
@@ -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;
index a81033f9357acccd3600db4b2fe7a23d2e8bdfeb..6cef974cd56ddba641bf22159221c2e6fc202ab9 100644 (file)
@@ -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;
index 4eb8a57e2442e4c0c2bb46fd83943d169688fb58..df7c802d1f6bed5828779e54388393b233c5dcbd 100644 (file)
@@ -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 (file)
index 0000000..0ece256
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+       /**
+        * Run the migrations.
+        */
+       public function up(): void {
+               Schema::table('episodes', function (Blueprint $table) {
+                       $table->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');
+               });
+       }
+};