]> git.localhorst.tv Git - alttp.git/blob - app/Http/Controllers/RoundController.php
basic result display
[alttp.git] / app / Http / Controllers / RoundController.php
1 <?php
2
3 namespace App\Http\Controllers;
4
5 use App\Models\Round;
6 use App\Models\Tournament;
7 use Illuminate\Http\Request;
8
9 class RoundController extends Controller
10 {
11
12         public function create(Request $request) {
13                 $validatedData = $request->validate([
14                         'tournament_id' => 'required|exists:App\\Models\\Tournament,id',
15                 ]);
16                 $tournament = Tournament::findOrFail($validatedData['tournament_id']);
17                 $this->authorize('addRound', $tournament);
18
19                 $round = Round::create([
20                         'tournament_id' => $validatedData['tournament_id'],
21                 ]);
22
23                 return $round->toJson();
24         }
25
26 }