$tournament->loadMax('rounds', 'number');
$round = Round::create([
+ 'game' => $tournament->game,
'number' => intval($tournament->rounds_max_number) + 1,
+ 'no_record' => $tournament->no_record,
'tournament_id' => $validatedData['tournament_id'],
]);
return $round->toJson();
}
+ 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();
+ }
+
public function setSeed(Request $request, Round $round) {
$this->authorize('setSeed', $round);
RoundChanged::dispatch($round);
- $round->load('results');
+ $round->load(['results', 'results.user']);
return $round->toJson();
}
RoundChanged::dispatch($round);
- $round->load('results');
+ $round->load(['results', 'results.user']);
return $round->toJson();
}
RoundChanged::dispatch($round);
- $round->load('results');
+ $round->load(['results', 'results.user']);
return $round->toJson();
}