https://laravel.com/docs/5.5/eloquent-relationships#querying-relationship-existence
// Posts and Tags have the "many to many" relation. $arrayOfTags = [1,2,5]; $posts = Post::whereHas('tags', function($q) { $q->whereIn('tags.id', $arrayOfTags); } )->get();