]> git.localhorst.tv Git - alttp.git/blobdiff - app/Models/Protocol.php
option to hide round numbers
[alttp.git] / app / Models / Protocol.php
index 7a90851a706c43b0d0b5e0ce417eb30fdbe6df35..60b25f2ad8cd6cd21c4003fc747e40c808e1b132 100644 (file)
@@ -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,
@@ -110,7 +123,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 +145,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 +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,
@@ -156,6 +205,42 @@ 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 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,
+                       'user_id' => $user ? $user->id : null,
+                       'type' => 'tournament.unlock',
+                       'details' => [
+                               'tournament' => static::tournamentMemo($tournament),
+                       ],
+               ]);
+               ProtocolAdded::dispatch($protocol);
+       }
+
 
        protected static function applicationMemo(Application $application) {
                return [
@@ -215,6 +300,7 @@ class Protocol extends Model
 
        protected $casts = [
                'details' => 'array',
+               'user_id' => 'string',
        ];
 
        protected $fillable = [