refactor: update DashboardController to use imported models for product and category counts
This commit is contained in:
parent
bc365ebb4d
commit
8ce493ebf2
@ -12,6 +12,7 @@
|
|||||||
use App\Models\Attendance;
|
use App\Models\Attendance;
|
||||||
use App\Models\CashAccount;
|
use App\Models\CashAccount;
|
||||||
use App\Models\CashTransaction;
|
use App\Models\CashTransaction;
|
||||||
|
use App\Models\Category;
|
||||||
use App\Models\Cutting;
|
use App\Models\Cutting;
|
||||||
use App\Models\CuttingResult;
|
use App\Models\CuttingResult;
|
||||||
use App\Models\Employee;
|
use App\Models\Employee;
|
||||||
@ -22,6 +23,7 @@
|
|||||||
use App\Models\OrderItem;
|
use App\Models\OrderItem;
|
||||||
use App\Models\Payroll;
|
use App\Models\Payroll;
|
||||||
use App\Models\PayrollPeriod;
|
use App\Models\PayrollPeriod;
|
||||||
|
use App\Models\Product;
|
||||||
use App\Models\ProductVariant;
|
use App\Models\ProductVariant;
|
||||||
use App\Models\Purchase;
|
use App\Models\Purchase;
|
||||||
use App\Models\RawMaterialPrice;
|
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')
|
->selectRaw('SUM(cutting_results.warehouse_stock * cuttings.cost_per_unit) as total_value')
|
||||||
->value('total_value');
|
->value('total_value');
|
||||||
|
|
||||||
$totalProducts = \App\Models\Product::query()->count();
|
$totalProducts = Product::query()->count();
|
||||||
$totalCategories = \App\Models\Category::query()->count();
|
$totalCategories = Category::query()->count();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'total_stock' => $totalStock,
|
'total_stock' => $totalStock,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user