SHARE
TWEET

Untitled

a guest Mar 19th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Posts and Tags have the "many to many" relation.
  2.  
  3. $arrayOfTags = [1,2,5];
  4.  
  5. $posts = Post::whereHas('tags', function($q) {
  6.     $q->whereIn('tags.id', $arrayOfTags);
  7. } )->get();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top