field('id,price,price_json')->where('pricedate','neq',$today)->order('id asc')->limit(50)->select(); foreach($car_list as $key => $val){ $update = ['pricedate'=>$today]; if(!empty($val['price_json'])){ $price_json = json_decode($val['price_json'],true); if(is_array($price_json) && isset($price_json[$todaydate])){ $update['pricetoday'] = $price_json[$todaydate]; } } $update['pricetoday'] = $val['price']; Db::name('car')->where('id',$val['id'])->update($update); } } }