Skip to content
Advertisement

Laravel get array find collection and delete all

i need to get the id in the form of an array and delete it if they belong to user

   Events::where('user_id', auth()->id())->find([67,69])->delete();

when trying to delete, I get this error when trying to delete, I get this error

Advertisement

Answer

I think you can do it in very simple way i think

Events::where('user_id', auth()->id())
    ->whereIn('id',[67,69])
    ->delete();
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement