X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FHttp%2FControllers%2FTournamentController.php;h=2dc7e51a84ae104597626dd05950b4383c55e873;hb=e1ecc76c1c6d527502d6576ee19be06df2a15bb7;hp=f53dad4b644e5aee03481c5e670424ea6e8fe1ac;hpb=d518ede5ffe8d4e44b0194279a9f32839bc1f903;p=alttp.git diff --git a/app/Http/Controllers/TournamentController.php b/app/Http/Controllers/TournamentController.php index f53dad4..2dc7e51 100644 --- a/app/Http/Controllers/TournamentController.php +++ b/app/Http/Controllers/TournamentController.php @@ -102,6 +102,22 @@ class TournamentController extends Controller return $rounds->toArray(); } + public function settings(Request $request, Tournament $tournament) { + $this->authorize('update', $tournament); + $validatedData = $request->validate([ + 'show_numbers' => 'boolean|nullable', + ]); + if (array_key_exists('show_numbers', $validatedData)) { + $tournament->show_numbers = $validatedData['show_numbers']; + } + $tournament->save(); + if ($tournament->wasChanged()) { + TournamentChanged::dispatch($tournament); + Protocol::tournamentSettings($tournament, $request->user()); + } + return $tournament->toJson(); + } + public function open(Request $request, Tournament $tournament) { $this->authorize('update', $tournament); $tournament->accept_applications = true;