]> git.localhorst.tv Git - alttp.git/blobdiff - app/Http/Controllers/RoundController.php
allow admins to lock/unlock rounds
[alttp.git] / app / Http / Controllers / RoundController.php
index f7e70423f07a987689e03bc5ec15f69f64bc7da4..4938b3a04a0bac61c31ccd2d2ba49dd604d2209c 100644 (file)
@@ -60,4 +60,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();
+       }
+
 }