From 2a6d4afdee85e4fba8cdc0acf00af7ed2359684a Mon Sep 17 00:00:00 2001 From: Yoga Pangestu Date: Sat, 20 Jun 2026 21:48:37 +0700 Subject: [PATCH] refactor: remove unused imports and improve SQL query formatting in DashboardController for cleaner code --- app/Http/Controllers/Admin/DashboardController.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/Http/Controllers/Admin/DashboardController.php b/app/Http/Controllers/Admin/DashboardController.php index d99f17a..e022e7d 100644 --- a/app/Http/Controllers/Admin/DashboardController.php +++ b/app/Http/Controllers/Admin/DashboardController.php @@ -2,7 +2,6 @@ namespace App\Http\Controllers\Admin; -use App\Enums\CashTransactionType; use App\Enums\CuttingStatus; use App\Enums\EmployeeAdvanceStatus; use App\Enums\EmploymentStatus; @@ -27,7 +26,6 @@ use App\Models\Purchase; use App\Models\RawMaterialPrice; use Carbon\Carbon; -use Illuminate\Support\Facades\DB; use Inertia\Inertia; use Inertia\Response; @@ -261,7 +259,7 @@ private function getOrderStats(): array ->whereNotNull('marketing_id') ->join('users', 'orders.marketing_id', '=', 'users.id') ->leftJoin('user_profiles', 'users.id', '=', 'user_profiles.user_id') - ->selectRaw("COALESCE(user_profiles.full_name, users.username) as name, COUNT(*) as count, SUM(orders.total_amount) as total") + ->selectRaw('COALESCE(user_profiles.full_name, users.username) as name, COUNT(*) as count, SUM(orders.total_amount) as total') ->groupBy('orders.marketing_id', 'users.username', 'user_profiles.full_name') ->orderByDesc('total') ->limit(5)