X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FHttp%2FControllers%2FTournamentController.php;h=e2fbe941a31b6b2b705b1e35c69724e495351191;hb=f446d5bcf3b87bd9443a060e27e9c0601c96fbb9;hp=7f6c913a2ba74b739f526acdb1f86dca96065262;hpb=d566d913c251fbb05e6bd314cc51f8b5ca49fe57;p=alttp.git diff --git a/app/Http/Controllers/TournamentController.php b/app/Http/Controllers/TournamentController.php index 7f6c913..e2fbe94 100644 --- a/app/Http/Controllers/TournamentController.php +++ b/app/Http/Controllers/TournamentController.php @@ -60,6 +60,22 @@ class TournamentController extends Controller return $tournament->toJson(); } + public function discordSettings(Request $request, Tournament $tournament) { + $this->authorize('update', $tournament); + $validatedData = $request->validate([ + 'round_template' => 'string|nullable', + ]); + 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;