]> git.localhorst.tv Git - alttp.git/blobdiff - app/Http/Controllers/RoundController.php
round titles
[alttp.git] / app / Http / Controllers / RoundController.php
index 04e1b865ca0fb3560be7ac9231e5f998b3974897..2b6c617acfbaa03d93df72544f4881d2036eb812 100644 (file)
@@ -39,6 +39,31 @@ class RoundController extends Controller
                return $round->toJson();
        }
 
+       public function update(Request $request, Round $round) {
+               $this->authorize('update', $round);
+
+               $validatedData = $request->validate([
+                       'seed' => 'url',
+                       'title' => 'string',
+               ]);
+
+               $round->seed = $validatedData['seed'];
+               $round->title = $validatedData['title'];
+               $round->update();
+
+               Protocol::roundEdited(
+                       $round->tournament,
+                       $round,
+                       $request->user(),
+               );
+
+               RoundChanged::dispatch($round);
+
+               $round->load(['results', 'results.user']);
+
+               return $round->toJson();
+       }
+
        public function setSeed(Request $request, Round $round) {
                $this->authorize('setSeed', $round);