X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FModels%2FProtocol.php;h=60b25f2ad8cd6cd21c4003fc747e40c808e1b132;hb=HEAD;hp=440aa0bec631e877901c80bff870abf921939ac7;hpb=43da6b2ec78774e7b045a09c68af39717b5f5dbc;p=alttp.git diff --git a/app/Models/Protocol.php b/app/Models/Protocol.php index 440aa0b..60b25f2 100644 --- a/app/Models/Protocol.php +++ b/app/Models/Protocol.php @@ -93,6 +93,19 @@ class Protocol extends Model ProtocolAdded::dispatch($protocol); } + public static function roundEdited(Tournament $tournament, Round $round, User $user) { + $protocol = static::create([ + 'tournament_id' => $tournament->id, + 'user_id' => $user->id, + 'type' => 'round.edit', + 'details' => [ + 'tournament' => static::tournamentMemo($tournament), + 'round' => static::roundMemo($round), + ], + ]); + ProtocolAdded::dispatch($protocol); + } + public static function roundLocked(Tournament $tournament, Round $round, User $user = null) { $protocol = static::create([ 'tournament_id' => $tournament->id, @@ -156,6 +169,30 @@ class Protocol extends Model ProtocolAdded::dispatch($protocol); } + public static function tournamentDiscord(Tournament $tournament, User $user = null) { + $protocol = static::create([ + 'tournament_id' => $tournament->id, + 'user_id' => $user ? $user->id : null, + 'type' => 'tournament.discord', + 'details' => [ + 'tournament' => static::tournamentMemo($tournament), + ], + ]); + ProtocolAdded::dispatch($protocol); + } + + public static function tournamentDiscordSettings(Tournament $tournament, User $user = null) { + $protocol = static::create([ + 'tournament_id' => $tournament->id, + 'user_id' => $user ? $user->id : null, + 'type' => 'tournament.discordSettings', + 'details' => [ + 'tournament' => static::tournamentMemo($tournament), + ], + ]); + ProtocolAdded::dispatch($protocol); + } + public static function tournamentLocked(Tournament $tournament, User $user = null) { $protocol = static::create([ 'tournament_id' => $tournament->id, @@ -168,7 +205,7 @@ class Protocol extends Model ProtocolAdded::dispatch($protocol); } - public static function tournamentOpenen(Tournament $tournament, User $user = null) { + public static function tournamentOpened(Tournament $tournament, User $user = null) { $protocol = static::create([ 'tournament_id' => $tournament->id, 'user_id' => $user ? $user->id : null, @@ -180,6 +217,18 @@ class Protocol extends Model ProtocolAdded::dispatch($protocol); } + public static function tournamentSettings(Tournament $tournament, User $user = null) { + $protocol = static::create([ + 'tournament_id' => $tournament->id, + 'user_id' => $user ? $user->id : null, + 'type' => 'tournament.settings', + 'details' => [ + 'tournament' => static::tournamentMemo($tournament), + ], + ]); + ProtocolAdded::dispatch($protocol); + } + public static function tournamentUnlocked(Tournament $tournament, User $user = null) { $protocol = static::create([ 'tournament_id' => $tournament->id, @@ -251,6 +300,7 @@ class Protocol extends Model protected $casts = [ 'details' => 'array', + 'user_id' => 'string', ]; protected $fillable = [