]> git.localhorst.tv Git - alttp.git/blobdiff - app/Models/Protocol.php
allow admins to lock/unlock rounds
[alttp.git] / app / Models / Protocol.php
index 5b871f43a71d87adbc8170963b89bd46629f39a4..4659665e87ffddeed7adcae097afcd0df81f3cd2 100644 (file)
@@ -62,6 +62,19 @@ class Protocol extends Model
                ProtocolAdded::dispatch($protocol);
        }
 
+       public static function roundUnlocked(Tournament $tournament, Round $round, User $user = null) {
+               $protocol = static::create([
+                       'tournament_id' => $tournament->id,
+                       'user_id' => $user ? $user->id : null,
+                       'type' => 'round.unlock',
+                       'details' => [
+                               'tournament' => static::tournamentMemo($tournament),
+                               'round' => static::roundMemo($round),
+                       ],
+               ]);
+               ProtocolAdded::dispatch($protocol);
+       }
+
        public static function tournamentCreated(Tournament $tournament, User $user) {
                $protocol = static::create([
                        'tournament_id' => $tournament->id,
@@ -98,6 +111,7 @@ class Protocol extends Model
        protected static function roundMemo(Round $round) {
                return [
                        'id' => $round->id,
+                       'number' => $round->number,
                        'seed' => $round->seed,
                ];
        }