refactor: update DashboardController to use imported models for product and category counts

This commit is contained in:
Yoga Pangestu 2026-06-22 11:14:15 +07:00
parent bc365ebb4d
commit 8ce493ebf2

View File

@ -12,6 +12,7 @@
use App\Models\Attendance;
use App\Models\CashAccount;
use App\Models\CashTransaction;
use App\Models\Category;
use App\Models\Cutting;
use App\Models\CuttingResult;
use App\Models\Employee;
@ -22,6 +23,7 @@
use App\Models\OrderItem;
use App\Models\Payroll;
use App\Models\PayrollPeriod;
use App\Models\Product;
use App\Models\ProductVariant;
use App\Models\Purchase;
use App\Models\RawMaterialPrice;
@ -101,8 +103,8 @@ private function getProductStock(): array
->selectRaw('SUM(cutting_results.warehouse_stock * cuttings.cost_per_unit) as total_value')
->value('total_value');
$totalProducts = \App\Models\Product::query()->count();
$totalCategories = \App\Models\Category::query()->count();
$totalProducts = Product::query()->count();
$totalCategories = Category::query()->count();
return [
'total_stock' => $totalStock,