title: Laravel query - Join and GroupBy
body: <p>I'm using laravel and I'm trying to select some stuff from the table..</p>
  
  <pre><code>$cars= DB::table('cars')
          -&gt;leftJoin('types', 'cars.type_id', '=', 'types.id')
          -&gt;groupBy('types.id')-&gt;get();
  </code></pre>
  
  <p>Basically I want 'cars' grouped in subarrays of the same "types".. but it ends up merging all group entries into only one of each car.</p>
  
  <p>How can I make this query?</p>