Files
nuhodds_fi4/app/Console/Commands/Grapper/TxOdds/Fixtures/TxLigas.php
T
2025-08-27 12:51:03 +02:00

33 lines
756 B
PHP

<?php
namespace App\Console\Commands\Grapper\TxOdds;
use App\Console\Commands\NuhBash;
use App\Models\Country;
use App\Models\Liga;
class TxLigas
{
public static function find($group)
{
$debug = NuhBash::$options['debug'] ?? 0;
$cgid = array_column($group, 'cgid');
$cnid = array_column($group, 'cnid');
$spid = array_column($group, 'spid');
$cname = array_column($group, 'cname');
$country_id = Country::where('txid', $cnid)->value('id');
$liga = Liga::firstOrCreate([
'name' => (string) $cname[0],
'sport_id' => (int) $spid[0],
'country_id' => $country_id,
'txodds_id' => (int) $cgid[0],
]);
return $liga->id;
}
}