+ public function update(Request $request, Round $round) {
+ $this->authorize('update', $round);
+
+ $validatedData = $request->validate([
+ 'code' => 'array',
+ 'code.*' => 'string',
+ 'rolled_by' => 'nullable|exists:App\\Models\\User,id',
+ 'seed' => 'url',
+ 'spoiler' => 'url',
+ 'title' => 'string',
+ ]);
+
+ $round->code = array_filter($validatedData['code']);
+ $round->rolled_by = $validatedData['rolled_by'];
+ $round->seed = $validatedData['seed'];
+ $round->spoiler = $validatedData['spoiler'];
+ $round->title = $validatedData['title'];
+ $round->update();
+
+ Protocol::roundEdited(
+ $round->tournament,
+ $round,
+ $request->user(),
+ );
+
+ RoundChanged::dispatch($round);
+
+ $round->load(['results', 'results.user']);
+
+ return $round->toJson();
+ }
+