I'm using laravel and I'm trying to select some stuff from the table..
$cars= DB::table('cars')
->leftJoin('types', 'cars.type_id', '=', 'types.id')
->groupBy('types.id')->get();
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.
How can I make this query?