feat: add active and nonactive scopes to RawMaterial model and apply active scope in CuttingService

This commit is contained in:
Yoga Pangestu 2026-08-06 09:57:01 +07:00
parent 62341ac50a
commit 577329365a
2 changed files with 13 additions and 0 deletions

View File

@ -41,6 +41,18 @@ protected function unitLabel(): Attribute
);
}
#[Scope]
protected function active(Builder $query): void
{
$query->where('is_active', true);
}
#[Scope]
protected function nonactive(Builder $query): void
{
$query->where('is_active', false);
}
#[Scope]
protected function kg(Builder $query): void
{

View File

@ -69,6 +69,7 @@ public function getForCreate(): array
->with([
'rawMaterialPrices:id,raw_material_id,variant,price,stock',
])
->active()
->orderBy('name')
->get()
->each(function (RawMaterial $rawMaterial) {