X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FModels%2FProtocol.php;h=440aa0bec631e877901c80bff870abf921939ac7;hb=43da6b2ec78774e7b045a09c68af39717b5f5dbc;hp=1214de6638962b8489cc537423b6f288528c4484;hpb=6f22614d8c68c68c88b44804802cdffeb3c6a3c7;p=alttp.git diff --git a/app/Models/Protocol.php b/app/Models/Protocol.php index 1214de6..440aa0b 100644 --- a/app/Models/Protocol.php +++ b/app/Models/Protocol.php @@ -132,6 +132,18 @@ class Protocol extends Model ProtocolAdded::dispatch($protocol); } + public static function tournamentClosed(Tournament $tournament, User $user = null) { + $protocol = static::create([ + 'tournament_id' => $tournament->id, + 'user_id' => $user ? $user->id : null, + 'type' => 'tournament.close', + 'details' => [ + 'tournament' => static::tournamentMemo($tournament), + ], + ]); + ProtocolAdded::dispatch($protocol); + } + public static function tournamentCreated(Tournament $tournament, User $user) { $protocol = static::create([ 'tournament_id' => $tournament->id, @@ -156,6 +168,30 @@ class Protocol extends Model ProtocolAdded::dispatch($protocol); } + public static function tournamentOpenen(Tournament $tournament, User $user = null) { + $protocol = static::create([ + 'tournament_id' => $tournament->id, + 'user_id' => $user ? $user->id : null, + 'type' => 'tournament.open', + 'details' => [ + 'tournament' => static::tournamentMemo($tournament), + ], + ]); + ProtocolAdded::dispatch($protocol); + } + + public static function tournamentUnlocked(Tournament $tournament, User $user = null) { + $protocol = static::create([ + 'tournament_id' => $tournament->id, + 'user_id' => $user ? $user->id : null, + 'type' => 'tournament.unlock', + 'details' => [ + 'tournament' => static::tournamentMemo($tournament), + ], + ]); + ProtocolAdded::dispatch($protocol); + } + protected static function applicationMemo(Application $application) { return [