3 namespace App\Http\Controllers;
5 use App\Events\RoundAdded;
6 use App\Models\Protocol;
8 use App\Models\Tournament;
9 use Illuminate\Http\Request;
11 class RoundController extends Controller
14 public function create(Request $request) {
15 $validatedData = $request->validate([
16 'tournament_id' => 'required|exists:App\\Models\\Tournament,id',
18 $tournament = Tournament::findOrFail($validatedData['tournament_id']);
19 $this->authorize('addRound', $tournament);
21 $round = Round::create([
22 'tournament_id' => $validatedData['tournament_id'],
31 RoundAdded::dispatch($round);
33 return $round->toJson();