Files
nuhodds_fi4/app/Console/Commands/Comparatore/Comparatore.php
T
2025-08-14 11:23:27 +02:00

65 lines
1.9 KiB
PHP

<?php
namespace App\Console\Commands\Comparatore;
use App\Models\Event;
use App\Models\EventBookmaker;
use App\Models\Supervisor;
use App\Utilities\Notice;
use App\Utilities\Supervisorctl;
use Illuminate\Console\Command;
use Illuminate\Support\Carbon;
class Comparatore extends Command
{
public static $events = [];
public static $sport_id = 0;
public static $options = [];
public static $force = 0;
public static $debug = 0;
protected $signature = 'com {process=help} {eventid=0} {--d} {--f} {--a} {--p} {--w}';
protected $description = 'Comparatore';
public function handle()
{
self::$options = $this->options();
self::$options['supervisor_id'] = $this->argument('process');
self::$options['event_id'] = $this->argument('eventid');
if ($this->argument('process') == 'help') {
$txt = PHP_EOL.'a com process [id] eventid [id]'.PHP_EOL;
$txt .= '--d debug'.PHP_EOL;
$txt .= '--f force update market'.PHP_EOL;
$txt .= '--a reload all'.PHP_EOL;
$txt .= '--w reload one week'.PHP_EOL;
$txt .= '--p print feed'.PHP_EOL.PHP_EOL;
$txt .= 'eventid'.PHP_EOL.PHP_EOL;
$txt .= 'use "com l" to show options'.PHP_EOL;
Notice::note($txt, 'b', 1);
} elseif ($this->argument('process') == 'l') {
$txt = 'list of comparatore processes';
$txt .= Supervisor::list('com');
Notice::note($txt, 'b', 1);
}
Supervisorctl::start(self::$options);
$res = Event::where('time', '>', Carbon::now()->toDateTimeString())->get();
foreach ($res as $event) {
$bookmaker = EventBookmaker::where('event_id', $event->id)->get();
if ($bookmaker->count() != null) {
dd($bookmaker);
}
}
Supervisorctl::end(self::$options);
}
}