I have this controller
public function UpdateRequest(ClientUpdate $request){
$res = Customer::where('id', $request->id)
->update([
'first_name' => $request->new_first_name,
'last_name' => $request->new_last_name,
'birthdate' => $request->new_birthdate,
'gender' => $request->new_gender,
'pending_update_info' => 2,
]);}
I have a form that is updating a customer what i want to do is for example the new_first_name is null and the rest of the field is have a data it will only update the field that has a data on it .
My Logic is like this:
if new_first_name is null and new_last_name is null update only the new_gender and new_birthday,
same with new_first_name is null and new_last_name is null and new_gender update only the new_birthday..
I dont know how to put in code in laravel hope you'll help me
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…