X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FModels%2FProtocol.php;h=67fb1cecbe0d95ada851375ae7a1598c8bb6967a;hb=b940ecdcd62df84881f4d4555801672155c9dcce;hp=7a90851a706c43b0d0b5e0ce417eb30fdbe6df35;hpb=cd36cb0ba2718e6bfa08765e7702d57dfe7fd733;p=alttp.git diff --git a/app/Models/Protocol.php b/app/Models/Protocol.php index 7a90851..67fb1ce 100644 --- a/app/Models/Protocol.php +++ b/app/Models/Protocol.php @@ -110,7 +110,7 @@ class Protocol extends Model $protocol = static::create([ 'tournament_id' => $tournament->id, 'user_id' => $user->id, - 'type' => 'round.create', + 'type' => 'round.seed', 'details' => [ 'tournament' => static::tournamentMemo($tournament), 'round' => static::roundMemo($round), @@ -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, @@ -144,6 +156,18 @@ 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 tournamentLocked(Tournament $tournament, User $user = null) { $protocol = static::create([ 'tournament_id' => $tournament->id, @@ -156,6 +180,30 @@ class Protocol extends Model ProtocolAdded::dispatch($protocol); } + public static function tournamentOpened(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 [