DB::raw() Query in Eloquent ->get();
ParkInfo::leftJoin('park_block_setup as block','block.park_id','=','park_info.id')
->where('park_info.is_archive', 0)
->groupBy('park_info.id')
->orderBy('park_info.park_name', 'asc')
->get([
'park_info.*',
DB::raw('ifnull(sum(block.has_land),0) has_land'),
DB::raw('ifnull(sum(block.has_space),0) has_space')
]);
->where('park_info.is_archive', 0)
->groupBy('park_info.id')
->orderBy('park_info.park_name', 'asc')
->get([
'park_info.*',
DB::raw('ifnull(sum(block.has_land),0) has_land'),
DB::raw('ifnull(sum(block.has_space),0) has_space')
]);
Comments
Post a Comment