namespace App\Http\Controllers;
use App\Events\ApplicationAdded;
+use App\Events\TournamentChanged;
use App\Models\Application;
use App\Models\Protocol;
use App\Models\Tournament;
return $tournament->toJson();
}
+ public function open(Request $request, Tournament $tournament) {
+ $this->authorize('update', $tournament);
+ $tournament->accept_applications = true;
+ $tournament->save();
+ TournamentChanged::dispatch($tournament);
+ Protocol::tournamentOpenen($tournament, $request->user());
+ return $tournament->toJson();
+ }
+
+ public function close(Request $request, Tournament $tournament) {
+ $this->authorize('update', $tournament);
+ $tournament->accept_applications = false;
+ $tournament->save();
+ TournamentChanged::dispatch($tournament);
+ Protocol::tournamentClosed($tournament, $request->user());
+ return $tournament->toJson();
+ }
+
+ public function lock(Request $request, Tournament $tournament) {
+ $this->authorize('update', $tournament);
+ $tournament->locked = true;
+ $tournament->save();
+ TournamentChanged::dispatch($tournament);
+ Protocol::tournamentLocked($tournament, $request->user());
+ return $tournament->toJson();
+ }
+
+ public function unlock(Request $request, Tournament $tournament) {
+ $this->authorize('update', $tournament);
+ $tournament->locked = false;
+ $tournament->save();
+ TournamentChanged::dispatch($tournament);
+ Protocol::tournamentUnlocked($tournament, $request->user());
+ return $tournament->toJson();
+ }
+
}