Laravel:使用find()更新多行

The*_*eal 0 laravel eloquent laravel-5

我有以下雄辩的代码:

$gifts = FriendGift::find($collectedGifts); // An array of IDS
Run Code Online (Sandbox Code Playgroud)

我想把所有人都设为collected = 1.

我试过这个:

$gifts->update(['collected' => 1]);
Run Code Online (Sandbox Code Playgroud)

但是我收到以下错误:

Method update does not exist
Run Code Online (Sandbox Code Playgroud)

怎么了?

lag*_*box 7

你没有打电话update给模特.你正在呼吁update一个没有方法的Eloquent Collection update.