I update 2 data, the first data is in the normal table, the second data uses EAV, therefore I have to use where to update the data that has the input ID
What im doing wrong..im getting this error..
this my controller
this is normal table
$vendor = Vendor::find($request->id);
$vendor->is_active = '0';
$vendor->name = $request->name;
$vendor->address = $request->address;
$vendor->save();
this is EAV Table
$values = [
'detail' => $request->detail,
'join_at' => Carbon::now(),
];
VendorDetail::whereIn('vendor_id', $request->id)->update($values);
When using whereIn()
in second argument you must be pass array
VendorDetail::whereIn('vendor_id', [$request->id])->update($values);
But in your case you can use
VendorDetail::where('vendor_id',$request->id)->update($values);
I got the same error in select query while using Eloquent. So posting my solution also. As already mentioned in other answers,
When using whereIn() in the second argument you must be array
My error was that I was using "=" as the second parameter and actual array as 3rd parameter. Removing the equal sign parameter like below resolved my issue.
$innerQuery->whereIn('wo.wm_is_completed', $completedFlagArr);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With