X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FModels%2FProtocol.php;h=fee8b881b492b0e0739df1289d3cde53c7575a19;hb=09c1644b5f64d7423905ae1be8f79da0b482289a;hp=e182c0885ae6e07e2f8bb12698b8c51adda64424;hpb=d748feb96453d74aeffec648d6f5f68d9ef3b520;p=alttp.git diff --git a/app/Models/Protocol.php b/app/Models/Protocol.php index e182c08..fee8b88 100644 --- a/app/Models/Protocol.php +++ b/app/Models/Protocol.php @@ -36,6 +36,32 @@ 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, + 'user_id' => $user->id, + 'type' => 'round.create', + '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, @@ -52,6 +78,7 @@ class Protocol extends Model protected static function resultMemo(Result $result) { return [ 'id' => $result->id, + 'forfeit' => $result->forfeit, 'time' => $result->time, ]; }