mardi 3 mars 2020

Laravel Multi condition database update

How to update database with multiple condition?

My Table name is work

+----+-----+
| id | num |
+----+-----+
| 1  | 56  |
+----+-----+
| 2  | 44  |
+----+-----+
| 3  | 85  |
+----+-----+

if input values are id=1,num=17

the table should be updated like this

+----+-----+
| id | num |
+----+-----+
| 1  | 17  |
+----+-----+
| 2  | 44  |
+----+-----+
| 3  | 85  |
+----+-----+

or if values are id=4,num=56

updated table should be like below

+----+-----+
| id | num |
+----+-----+
| 1  | 17  |
+----+-----+
| 2  | 44  |
+----+-----+
| 3  | 85  |
+----+-----+
| 4  | 56  |
+----+-----+

is there any Eloquent in laravel to update the table if not please give me a solution



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire