count with left join in laravel

Solutions on MaxInterview for count with left join in laravel by the best coders in the world

showing results for - "count with left join in laravel"
Mona
08 Jul 2016
1$areas = Area::select('areas.*', DB::raw('count(area_id) as connections'))
2	->leftJoin('object_areas', 'object_areas.area_id', '=', 'areas.id')
3	->groupBy('areas.id')
4	->get();
Lautaro
16 Apr 2018
1$areas = Area::select('areas.*', DB::raw('count(area_id) as connections'))
2	->leftJoin('object_areas', 'object_areas.area_id', '=', 'areas.id')
3	->groupBy('areas.id')    
4	->get();
Kimmy
18 Mar 2020
1$areas = Area::select('areas.*', DB::raw('count(area_id) as connections'))
2	->leftJoin('object_areas', 'object_areas.area_id', '=', 'areas.id')
3	->groupBy('areas.id')gg
4	->get();