where('bookmaker_id', $base['bookmaker_id'])->first(); if (! $res) { OddsGgng::create($odds); } else { $res->gg = $odds['gg']; $res->ng = $odds['ng']; if ($res->isDirty()) { $res->oddchange_at = now(); } $res->checked_at = $odds['checked_at']; $res->margin = $odds['margin']; $res->save(); } } }