Files
nuhodds_fi4/app/Console/Commands/Services/Tasks/CallTxoddsMarkets.php
T
2026-01-15 16:14:10 +01:00

35 lines
726 B
PHP

<?php
namespace App\Console\Commands\Services\Tasks;
use App\Console\Commands\Nuh;
use App\Console\Commands\Xml;
use App\Models\TxoddsMarket;
use App\Utilities\Notice;
class CallTxoddsMarkets
{
public static function call()
{
$debug = Nuh::$options['d'] ?? 0;
if ($debug) {
Notice::note('TxoddsMarkets', 'b');
}
$url = 'https://xml2.txodds.com/feed/odds_types.php';
$data = Xml::load($url);
foreach ($data as $row) {
$market = [
'shortname' => $row->sname,
'name' => (string) $row->name,
];
TxoddsMarket::updateOrCreate(['market_id' => (int) $row->ot], $market);
}
}
}