title: Laravel collection get occurrences of a MtoM relation
body: <p>this is my situation:<br>
  I have a collection of products and i want all the categories of those products.<br>
  Between <code>Product</code> and <code>Category</code> there is a many-to-many relation already created, and i want to do something like this:</p>
  
  <pre><code>$prods = Product::where(something)-&gt;get();
  $categories = $prods-&gt;categories();
  </code></pre>
  
  <p>But obviously this doesn't work, and i would avoid getting all categories for each products, and add it to a collection only if is not alredy in it... something like this:</p>
  
  <pre><code>select *
  from categories join pivot on categories.id = pivot.id
  where pivot.product_id IN (1,2,3,4,5)
  </code></pre>
  
  <p>where <code>1,2,3,4,5</code> are the ids of the products</p>
  
  <p>Is there any way to do it without <code>QueryBuilder</code> (using <code>Eloquent</code>)?</p>