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