From cb11ee9be67e492347bc12d81b5b2a7c06f1b270 Mon Sep 17 00:00:00 2001 From: Yoga Pangestu Date: Thu, 23 Apr 2026 13:28:29 +0700 Subject: [PATCH] fix: filter dashboard order statistics by current date --- app/Http/Controllers/DashboardController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Http/Controllers/DashboardController.php b/app/Http/Controllers/DashboardController.php index f9a5dfb..0dbac67 100644 --- a/app/Http/Controllers/DashboardController.php +++ b/app/Http/Controllers/DashboardController.php @@ -68,6 +68,7 @@ public function __invoke() $paymentMethods = DB::table('orders') ->select('payment_method as name', DB::raw('COUNT(*) as total')) + ->whereDate('created_at', $today) ->groupBy('payment_method') ->get() ->map(function ($item) { @@ -80,6 +81,7 @@ public function __invoke() $orderStatuses = DB::table('orders') ->select('order_status as name', DB::raw('COUNT(*) as total')) + ->whereDate('created_at', $today) ->groupBy('order_status') ->get() ->map(function ($item) { @@ -92,6 +94,7 @@ public function __invoke() $orderChannels = DB::table('orders') ->select('order_channel as name', DB::raw('COUNT(*) as total')) + ->whereDate('created_at', $today) ->groupBy('order_channel') ->get() ->map(function ($item) {