+ public static function roundAdded(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,
+ 'user_id' => $user->id,
+ 'type' => 'tournament.create',
+ 'details' => [
+ 'tournament' => static::tournamentMemo($tournament),
+ ],
+ ]);
+ ProtocolAdded::dispatch($protocol);
+ }
+
+
+ protected static function roundMemo(Round $round) {
+ return [
+ 'id' => $round->id,
+ 'seed' => $round->seed,
+ ];
+ }
+
+ protected static function tournamentMemo(Tournament $tournament) {
+ return [
+ 'id' => $tournament->id,
+ 'title' => $tournament->title,
+ ];
+ }
+
+ protected static function userMemo(User $user) {
+ return [
+ 'id' => $user->id,
+ 'username' => $user->username,
+ 'discriminator' => $user->discriminator,
+ 'avatar' => $user->avatar,
+ ];
+ }
+
+