Files
nuhodds_fi4/app/Console/Commands/Grapper/TxOdds/Groups.php
T

55 lines
1.5 KiB
PHP

<?php
namespace App\Console\Commands\Grapper\TxOdds;
use App\Console\Commands\Nuh;
use App\Console\Commands\Xml;
use App\Models\Group;
use App\Models\Sport;
use App\Utilities\Notice;
class Groups
{
public static function grap()
{
$debug = Nuh::$options['d'] ?? 0;
$kontos = ['soccer' => config('env.txodds_betaid1'), 'other' => config('env.txodds_betaid2')];
$sports = Sport::getActiveSports();
Group::whereNotIn('sport_id', $sports)->delete();
$years = [date('y'), date('y') + 1];
foreach ($kontos as $konto => $authentication) {
$url = 'https://xml2.txodds.com/feed/groups.php?'.$authentication.'&sid='.implode(',', $years);
$data = Xml::load($url);
dd($data);
$count = 0;
foreach ($data as $row) {
if (in_array()) {
Group::updateOrCreate(
['id' => (int) $row->id],
[
'mgroup' => (string) $row->mgroup,
'name' => (string) $row->name,
'fullname' => (string) $row->fullname,
'sid' => (string) $row->sid,
'date1' => (string) $row->date1,
'date2' => (string) $row->date2,
]
);
}
$count++;
}
Notice::note("$count groups $konto processed", 'g');
}
}
}