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()
?
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 fromMyMode
model.