Files
nuhodds_fi4/app/Console/Commands/Grapper/TxOdds/Odds/_Tq.php
T
2026-01-18 10:40:19 +01:00

28 lines
632 B
PHP

<?php
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class _Tq
{
public static function grap($odds, $offer)
{
foreach ($offer as $value) {
$odds['htq'] = (float) $value->o1;
$odds['atq'] = (float) $value->o3;
}
$odds['margin'] = (float) Margin::calculate([$odds['htq'], $odds['atq']], 1);
$odds['updated_at'] = now();
DB::table('odds_tq')->upsert(
$odds,
['event_id', 'bookmaker_id'],
['htq', 'atq', 'margin', 'flags', 'updated_at']
);
}
}