28 lines
630 B
PHP
28 lines
630 B
PHP
<?php
|
|
|
|
namespace App\Console\Commands\Grapper\TxOdds\Odds;
|
|
|
|
use App\Utilities\Margin;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class _Ggng
|
|
{
|
|
public static function grap($odds, $offer)
|
|
{
|
|
foreach ($offer as $value) {
|
|
$odds['gg'] = (float) $value->o1;
|
|
$odds['ng'] = (float) $value->o3;
|
|
}
|
|
$odds['margin'] = (float) Margin::calculate([$odds['gg'], $odds['ng']], 1);
|
|
$odds['updated_at'] = now();
|
|
DB::table('odds_ggng')->upsert(
|
|
$odds,
|
|
|
|
['event_id', 'bookmaker_id'],
|
|
|
|
['gg', 'ng', 'margin', 'flags', 'updated_at']
|
|
|
|
);
|
|
}
|
|
}
|