Reputation: 29
MyMode::whereNotIn('id', $someCollection->pluck('id')->toArray())->delete();
removes all values from the table. But I think it shoudt remove only items which are not present in $someCollection
.
How to remove items which are not in $someCollection->pluck('id')->toArray()
?
Upvotes: 0
Views: 420
Reputation: 111829
It should work without a problem. You should verify first what you have in $someCollection->pluck('id')->toArray()
to make sure it doesn't return all/none rows from MyMode
model.
Upvotes: 1