ItemTable::where('item_type_id', '=', 1)
->update(['colour' => 'black']);
Jan 4, 2015
10
Level 25
Update multiple records using Eloquent
Hi LarPeeps,
How can I update multiple rows with a single query like:
$update = mysql_query("update item_table set colour = 'black' where item_type_id = 1");
lets say I have 20 rows with the item_type_id of 1 the above would update them all, but when I try:
$update = ItemTable::where('item_type_id', '=', 1);
$update->colour = 'black';
$update->save();
laravel spits its dummy out :( any help would be greatly appreciated.
Thanks in advance.
Level 6
30 likes
Please or to participate in this conversation.