Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 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();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement