X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FModels%2FProtocol.php;h=5b871f43a71d87adbc8170963b89bd46629f39a4;hb=7016f4b28fa1324269ae9e2a8aad28dd562927d4;hp=ddbc441d40a12fe185fe82ac7f52ce9358b7a21f;hpb=812a270c7a410461e931394496512d36b34ef7b5;p=alttp.git diff --git a/app/Models/Protocol.php b/app/Models/Protocol.php index ddbc441..5b871f4 100644 --- a/app/Models/Protocol.php +++ b/app/Models/Protocol.php @@ -36,6 +36,19 @@ class Protocol extends Model ProtocolAdded::dispatch($protocol); } + public static function roundLocked(Tournament $tournament, Round $round, User $user = null) { + $protocol = static::create([ + 'tournament_id' => $tournament->id, + 'user_id' => $user ? $user->id : null, + 'type' => 'round.lock', + 'details' => [ + 'tournament' => static::tournamentMemo($tournament), + 'round' => static::roundMemo($round), + ], + ]); + ProtocolAdded::dispatch($protocol); + } + public static function roundSeedSet(Tournament $tournament, Round $round, User $user) { $protocol = static::create([ 'tournament_id' => $tournament->id, @@ -61,6 +74,18 @@ class Protocol extends Model ProtocolAdded::dispatch($protocol); } + public static function tournamentLocked(Tournament $tournament, User $user = null) { + $protocol = static::create([ + 'tournament_id' => $tournament->id, + 'user_id' => $user ? $user->id : null, + 'type' => 'tournament.lock', + 'details' => [ + 'tournament' => static::tournamentMemo($tournament), + ], + ]); + ProtocolAdded::dispatch($protocol); + } + protected static function resultMemo(Result $result) { return [