3 namespace App\Console\Commands;
5 use App\Models\Tournament;
6 use Illuminate\Console\Command;
8 class RecalculateTournamentPlacements extends Command
11 * The name and signature of the console command.
15 protected $signature = 'tournament:recalc {tournament}';
18 * The console command description.
22 protected $description = 'Recalculate tournament placements';
25 * Execute the console command.
29 public function handle()
31 $tournament = Tournament::findOrFail($this->argument('tournament'));
33 foreach ($tournament->rounds as $round) {
34 $round->updatePlacement();
36 $tournament->updatePlacement();