Thursday, March 2, 2017

Laravel: Update multiple rows using find()

I have the following eloquent code:

$gifts = FriendGift::find($collectedGifts); // An array of IDS

I want to set all as collected = 1.

I tried this:

$gifts->update(['collected' => 1]);

but I get the following error:

Method update does not exist

What's wrong?




via TheUnreal

Advertisement