X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FHttp%2FControllers%2FRoundController.php;fp=app%2FHttp%2FControllers%2FRoundController.php;h=d884d544bb22f5bd728e5e2f24859ab81ea6647e;hb=a907ef7c6676fef11f42933b2d79bdd496b20122;hp=1488d97bff92e15004407c2bc6493f507761bfcd;hpb=06fd14404164904304a20e2280037e83299247fa;p=alttp.git diff --git a/app/Http/Controllers/RoundController.php b/app/Http/Controllers/RoundController.php index 1488d97..d884d54 100644 --- a/app/Http/Controllers/RoundController.php +++ b/app/Http/Controllers/RoundController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers; use App\Events\RoundAdded; +use App\Events\RoundChanged; use App\Models\Protocol; use App\Models\Round; use App\Models\Tournament; @@ -33,4 +34,27 @@ class RoundController extends Controller return $round->toJson(); } + public function setSeed(Request $request, Round $round) { + $this->authorize('setSeed', $round); + + $validatedData = $request->validate([ + 'seed' => 'required|url', + ]); + + $round->seed = $validatedData['seed']; + $round->update(); + + Protocol::roundSeedSet( + $round->tournament, + $round, + $request->user(), + ); + + RoundChanged::dispatch($round); + + $round->load('results'); + + return $round->toJson(); + } + }