Answers for "how to use having and group by in laravel orm"

PHP
0

laravel group by with where clause

$groupedSalesCampaign = Order::with('Campaign')
            ->where('isapproved','=','Y')
            ->groupBy('campaign_id')
            ->orderBy(DB::raw('COUNT(id)','desc'))
            ->get(array(DB::raw('COUNT(id) as totalsales'),'campaign_id'));
Posted by: Guest on September-10-2020

Code answers related to "how to use having and group by in laravel orm"

Browse Popular Code Answers by Language