]> git.localhorst.tv Git - alttp.git/blob - app/Console/Commands/LockRound.php
add myustery circus link
[alttp.git] / app / Console / Commands / LockRound.php
1 <?php
2
3 namespace App\Console\Commands;
4
5 use App\Events\RoundChanged;
6 use App\Models\Protocol;
7 use App\Models\Round;
8 use Illuminate\Console\Command;
9
10 class LockRound extends Command
11 {
12         /**
13          * The name and signature of the console command.
14          *
15          * @var string
16          */
17         protected $signature = 'round:lock {round}';
18
19         /**
20          * The console command description.
21          *
22          * @var string
23          */
24         protected $description = 'Lock the round';
25
26         /**
27          * Execute the console command.
28          *
29          * @return int
30          */
31         public function handle()
32         {
33                 $round = Round::findOrFail($this->argument('round'));
34
35                 if ($round->locked) {
36                         $this->line('already locked');
37                         return 0;
38                 }
39
40                 $round->locked = true;
41                 $round->save();
42
43                 Protocol::roundLocked(
44                         $round->tournament,
45                         $round,
46                 );
47
48                 RoundChanged::dispatch($round);
49
50                 return 0;
51         }
52 }