X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FModels%2FProtocol.php;h=4659665e87ffddeed7adcae097afcd0df81f3cd2;hb=d1f28ea443b090c7593791eba9631796ccaeafe1;hp=5b871f43a71d87adbc8170963b89bd46629f39a4;hpb=7016f4b28fa1324269ae9e2a8aad28dd562927d4;p=alttp.git diff --git a/app/Models/Protocol.php b/app/Models/Protocol.php index 5b871f4..4659665 100644 --- a/app/Models/Protocol.php +++ b/app/Models/Protocol.php @@ -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, ]; }