I want update a row with only where clause. I don't have row id, only i have 2 where clause. Is it possible? (with eloquent)
->where("x",1) ->where("y"=2)
When using Active Record, you should never perform an update directly in the database. First pull the record from the database, then update it:
Model::where(['x' => 1, 'y' => 2])->first()->update([...]);
If you instead do the update directly in the database, none of the ORM functionality will trigger (such as firing events or touching parents).
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