From 11557d0b85f6eae0f046c786022a20b00c625b6c Mon Sep 17 00:00:00 2001 From: Yoga Pangestu Date: Thu, 30 Jul 2026 15:57:30 +0700 Subject: [PATCH] feat: remove global scope for ordered in raw material and product stock queries --- app/Services/System/AnalysisService.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Services/System/AnalysisService.php b/app/Services/System/AnalysisService.php index c229a1e..abf8b4e 100644 --- a/app/Services/System/AnalysisService.php +++ b/app/Services/System/AnalysisService.php @@ -709,6 +709,7 @@ public function getProfitMetrics(?Carbon $startDate = null, ?Carbon $endDate = n public function getRawMaterialStock(): array { $prices = RawMaterialPrice::query() + ->withoutGlobalScope('ordered') ->join('raw_materials', 'raw_material_prices.raw_material_id', '=', 'raw_materials.id') ->selectRaw(' raw_materials.unit, @@ -736,6 +737,7 @@ public function getRawMaterialStock(): array public function getProductStock(): array { $variants = ProductVariant::query() + ->withoutGlobalScope('ordered') ->join('products', 'product_variants.product_id', '=', 'products.id') ->where('products.status', ProductStatus::ACTIVE) ->selectRaw('