title: Laravel Eloquent Many to Many Query
body: <p>Please help me make this query in eloquent. A business can have many categories.</p>
  
  <pre><code>SELECT b.* 
  FROM   businesses b 
         INNER JOIN categorybusiness cb 
                 ON b.id = cb.business_id 
         INNER JOIN category c 
                 ON cb.category_id = c.id 
  WHERE  b.location LIKE '%query1%' 
         AND b.location LIKE '%query2%' 
         AND c.name LIKE '%query3%' 
         AND c.name LIKE '%query4%' 
  </code></pre>
  
  <p>my tables are.. businesses - contain the location column and a pivot table for category and business..</p>
  
  <p>UPDATE:
  so i used this query...</p>
  
  <pre><code>$business5 = Business::WhereHas('categories', function($q) use($category,$query1)
      {
            $q-&gt;whereRaw("name like '%$category%' or businesses.name like '%$category%' $query1");         
      })-&gt;get();
  </code></pre>
  
  <p>$query1 looks like this but in a loop.</p>
  
  <pre><code>     $query1 .= " and businesses.address1 like '%$string%'"; 
  </code></pre>
  
  <p>It's working fine but can someone help me make a "MATCH AGAINST" statement in eloquent from this.</p>