whereRaw("DATE_FORMAT(`service_date`,'%Y-%m') = '{$month}'") ->where("total", ">", 0)->get(); $order_items_count = $order_items->count(); $total = $order_items->sum("total"); $orders_count = $order_items->groupBy("order_id")->count(); foreach ($order_items as &$item) { $item = $item->calculateFee(); } $total_paramedic = $order_items->sum("paramedic_total"); $fee = $total - $total_paramedic; $laravel_duration = microtime(true) - LARAVEL_START; return view($this->bladePath . ".home", compact("orders_count", "order_items_count", "total", "total_paramedic", "fee", "laravel_duration")); } }