title: Laravel search many to many eloquent get result by pagination
body: <p>I have tree table: </p>
  
  <ol>
  <li>posts</li>
  <li>categories</li>
  <li>tags</li>
  </ol>
  
  <p>the posts fields are : title and text
  the categories field is : title
  the tags field is : title</p>
  
  <p>the relation between posts and categories is many to many.
  the relation between posts and tags is many to many.</p>
  
  <p>I want search keyword in title or body of posts (like), or in title of post categories, or title of post tags using eloquent and pagination.</p>
  
  <p>How do I do this?</p>
  
  <pre><code>class Post extends Model
  {
      public function categories()
      {
          return $this-&gt;belongsToMany(Category::class);
      }
  
      public function tags()
      {
          return $this-&gt;belongsToMany(Tag::class);
      }
  }
  
  class Category extends Model
  {
      public function posts()
      {
          return $this-&gt;belongsToMany(Post::class);
      }
  }
  
  class Tag extends Model
  {
      public function posts()
      {
          return $this-&gt;belongsToMany(Post::class);
      }
  }
  
  
  </code></pre>