diff --git a/app/Http/Controllers/Crm/CustomerController.php b/app/Http/Controllers/Crm/CustomerController.php index 90551f2c..893c76f5 100644 --- a/app/Http/Controllers/Crm/CustomerController.php +++ b/app/Http/Controllers/Crm/CustomerController.php @@ -196,9 +196,12 @@ class CustomerController extends Controller ]); foreach ($dataInfo as $d){ DB::table('customer_field_value') - ->where('customer_id','=',$id) - ->where('customer_field_id',$d['customer_field_id']) - ->update(['data'=>$d['data']]); + ->updateOrInsert([ + 'customer_id' => $id, + 'customer_field_id' => $d['customer_field_id'], + ],[ + 'data'=>$d['data'], + ]); } DB::commit(); return $this->success();