Files
nuhodds_fi4/app/Console/Commands/Grapper/TxOdds/Countries.php
T
2026-01-04 05:41:37 +01:00

36 lines
808 B
PHP

<?php
namespace App\Console\Commands\Grapper\TxOdds;
use App\Console\Commands\Curl;
use App\Console\Commands\Nuh;
use App\Models\Country;
use App\Utilities\Notice;
class Countries
{
public static function call()
{
$debug = Nuh::$options['d'] ?? 0;
$print = Nuh::$options['p'] ?? 0;
$url = 'https://xml2.txodds.com/feed/countries.php';
$data = Curl::load($url, $debug);
if ($print) {
Notice::note($data, '', 1);
}
$count = 0;
foreach ($data as $row) {
Country::updateOrCreate(
['id' => (int) $row->id],
['name' => (string) $row->name, 'cc' => (string) $row->cc]
);
$count++;
}
Notice::note("$count countries processed", 'g');
}
}