o1; $odds['ng'] = (float) $value->o3; } $odds['margin'] = (float) Margin::calculate([$odds['gg'], $odds['ng']], 1); $res = OddsGgng::where('event_id', $odds['event_id'])->where('bookmaker_id', $odds['bookmaker_id'])->first(); if (! $res) { OddsGgng::create($odds); } elseif (! $block_update) { $res->gg = $odds['gg']; $res->ng = $odds['ng']; $res->flags = 1; $res->margin = $odds['margin']; DatabaseFunctions::save_update($res); } } }