]> git.localhorst.tv Git - alttp.git/blobdiff - app/Http/Controllers/RoundController.php
add index option for tech sites
[alttp.git] / app / Http / Controllers / RoundController.php
index f7e70423f07a987689e03bc5ec15f69f64bc7da4..d616b861b3d0edb8c22d99679ae4f56614d1a079 100644 (file)
@@ -23,6 +23,7 @@ class RoundController extends Controller
 
                $round = Round::create([
                        'number' => intval($tournament->rounds_max_number) + 1,
+                       'no_record' => $tournament->no_record,
                        'tournament_id' => $validatedData['tournament_id'],
                ]);
 
@@ -60,4 +61,42 @@ class RoundController extends Controller
                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();
+       }
+
 }