Reputation: 2935
I am studding Laravel, I have table name call "projects". To display all projects I used
$projects= Project::all();
But I have project id array like this, I need to remove this projects from resualts
$doNotDisplayThisProjectsIds = array(4, 6, 20);
So how to remove above ids project from result, using Project::all(),
Upvotes: 1
Views: 1069
Reputation: 407
Have you considered using NOT IN? (I haven't tested this, so this is theory...)
$projects = Project::whereNotIn('id', $doNotDisplayThisProjectsIds)->get();
Upvotes: 5