Files
nuhodds_fi4/app/Console/Commands/Grapper/TxOdds/Countries.php
T
2026-02-24 17:27:47 +01:00

31 lines
683 B
PHP

<?php
namespace App\Console\Commands\Grapper\TxOdds;
use App\Console\Commands\Nuh;
use App\Console\Commands\Xml;
use App\Models\Country;
use App\Utilities\Notice;
class Countries
{
public static function grap()
{
$debug = Nuh::$options['d'] ?? 0;
$url = 'https://xml2.txodds.com/feed/countries.php';
$data = Xml::load($url);
$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');
}
}