FutureWeb
17388
7
General

Update multiple records using Eloquent

Posted 4 years ago by FutureWeb

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.

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.