3 namespace App\Console\Commands;
5 use App\Events\TournamentChanged;
6 use App\Models\Protocol;
7 use App\Models\Tournament;
8 use Illuminate\Console\Command;
10 class LockTournament extends Command
13 * The name and signature of the console command.
17 protected $signature = 'tournament:lock {tournament}';
20 * The console command description.
24 protected $description = 'Lock the tournament';
27 * Execute the console command.
31 public function handle()
33 $tournament = Tournament::findOrFail($this->argument('tournament'));
35 if ($tournament->locked) {
36 $this->line('already locked');
40 $tournament->locked = true;
43 Protocol::tournamentLocked(
47 TournamentChanged::dispatch($tournament);