title: laravel search many to many Relashionship
body: <p>I am testing eloquent for the first time and I want to see if it suit my application.</p>
  
  <p>I have Product table:</p>
  
  <pre><code>id, name
  </code></pre>
  
  <p>and model:</p>
  
  <pre><code>class Produit extends Eloquent {
  
      public function eavs()
      {
          return $this-&gt;belongsToMany('Eav')
                  -&gt;withPivot('value_int', 'value_varchar', 'value_date');
      }
  }
  </code></pre>
  
  <p>and eav table:</p>
  
  <pre><code>id, name, code, field_type
  </code></pre>
  
  <p>and pivot table:</p>
  
  <pre><code>product_id, eav_id, value_int, value_varchar, value_date
  </code></pre>
  
  <p>class Eav extends Eloquent {</p>
  
  <pre><code>public function produitTypes()
  {
      return $this-&gt;belongsToMany(
              'ProduitType'
              -&gt;withPivot('cs_attributs_produits_types_required');
  }
  </code></pre>
  
  <p>All this is working. 
  But I want to search in that relashionship:
  e.g: all product that  have eav_id=3 and value_int=3</p>
  
  <p>I have tested this:</p>
  
  <pre><code>$produits = Produit::with( array('eavs' =&gt; function($query)
      {
          $query-&gt;where('id', '3')-&gt;where('value_int', '3');
      }))-&gt;get();
  </code></pre>
  
  <p>But I get all the product, and eav data only for these who have id=3 and value_int=3.</p>
  
  <p>I want to get only the product that match this search...
  Thank you</p>