SELECT auto.*, count(parts.id) as total
FROM auto
LEFT JOIN parts ON auto.id = parts.auto_id
GROUP BY auto.id
DB::table('auto')
->select('auto.*', DB::raw('count(parts.id) as total'))
->join('parts', 'auto.id', '=', 'parts.auto_id')
->groupBy('auto.id')
->get();