24 lines
611 B
PHP
24 lines
611 B
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use Illuminate\Console\Command;
|
|
use App\Services\PairingEngine;
|
|
|
|
class RunPairing extends Command
|
|
{
|
|
protected $signature = 'pxg:pair {--event=1}';
|
|
protected $description = 'Run pairing engine for confirmed registrations (assign to flights).';
|
|
|
|
public function handle(PairingEngine $engine): int
|
|
{
|
|
$eventId = (int) $this->option('event');
|
|
$res = $engine->run($eventId);
|
|
$this->info('Assigned: '.$res['assigned']);
|
|
foreach (($res['notes'] ?? []) as $n) {
|
|
$this->line('- '.$n);
|
|
}
|
|
return 0;
|
|
}
|
|
}
|