$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 lock(Request $request, Round $round) {
+ $this->authorize('lock', $round);
+
+ $round->locked = true;
+ $round->update();
+
+ Protocol::roundLocked(
+ $round->tournament,
+ $round,
+ $request->user(),
+ );
+
+ RoundChanged::dispatch($round);
+
+ $round->load('results');
+
+ return $round->toJson();
+ }
+
+ public function unlock(Request $request, Round $round) {
+ $this->authorize('unlock', $round);
+
+ $round->locked = false;
+ $round->update();
+
+ Protocol::roundUnlocked(
+ $round->tournament,
+ $round,
+ $request->user(),
+ );
+
+ RoundChanged::dispatch($round);
+
+ $round->load('results');
+
+ return $round->toJson();
+ }
+
}