Files
nuhodds_fi4/app/Console/Commands/Grapper/TxOdds/Countries.php
T
2025-08-30 08:15:10 +02:00

36 lines
822 B
PHP

<?php
namespace App\Console\Commands\Grapper\TxOdds;
use App\Console\Commands\Curl;
use App\Console\Commands\NuhBash;
use App\Models\Country;
use App\Utilities\Notice;
class Countries
{
public static function call()
{
$debug = NuhBash::$options['d'] ?? 0;
$print = NuhBash::$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(
['txid' => (int) $row->id],
['name' => (string) $row->name, 'cc' => (string) $row->cc]
);
$count++;
}
Notice::note("$count countries processed", 'g');
}
}