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