Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update row based on two condition using eloquent in Laravel?

I have a table : Profile Table has one foreign key and primary key. I want to update row based on two condition . Like : where ( id == 1 and user == 'admin')

How to use two para meter in update query using eloquent.

like image 869
Sarita Sharma Avatar asked Dec 24 '22 06:12

Sarita Sharma


1 Answers

you can do this by make the following:

ModelName::where(['id'=>1,'user'=>'admin'])
->update(['column_name'=>'value',.....]);
like image 185
ali Avatar answered Jan 05 '23 15:01

ali