X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FHttp%2FControllers%2FTournamentController.php;h=9b21736d8ea4a111eece00198e6cd858ca856773;hb=31127000e16c18389129546b9aa652de565683fb;hp=7f6c913a2ba74b739f526acdb1f86dca96065262;hpb=b940ecdcd62df84881f4d4555801672155c9dcce;p=alttp.git diff --git a/app/Http/Controllers/TournamentController.php b/app/Http/Controllers/TournamentController.php index 7f6c913..9b21736 100644 --- a/app/Http/Controllers/TournamentController.php +++ b/app/Http/Controllers/TournamentController.php @@ -30,6 +30,7 @@ class TournamentController extends Controller 'applications.user', 'rounds', 'rounds.results', + 'rounds.results.user', 'participants', 'participants.user', )->findOrFail($id); @@ -60,12 +61,32 @@ class TournamentController extends Controller return $tournament->toJson(); } + public function discordSettings(Request $request, Tournament $tournament) { + $this->authorize('update', $tournament); + $validatedData = $request->validate([ + 'round_category' => 'string|nullable', + 'round_template' => 'string|nullable', + ]); + if (array_key_exists('round_category', $validatedData)) { + $tournament->discord_round_category = $validatedData['round_category']; + } + if (array_key_exists('round_template', $validatedData)) { + $tournament->discord_round_template = $validatedData['round_template']; + } + $tournament->save(); + if ($tournament->wasChanged()) { + TournamentChanged::dispatch($tournament); + Protocol::tournamentDiscordSettings($tournament, $request->user()); + } + return $tournament->toJson(); + } + public function open(Request $request, Tournament $tournament) { $this->authorize('update', $tournament); $tournament->accept_applications = true; $tournament->save(); TournamentChanged::dispatch($tournament); - Protocol::tournamentOpenen($tournament, $request->user()); + Protocol::tournamentOpened($tournament, $request->user()); return $tournament->toJson(); }