feat: add active and nonactive scopes to RawMaterial model and apply active scope in CuttingService
This commit is contained in:
parent
62341ac50a
commit
577329365a
@ -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]
|
#[Scope]
|
||||||
protected function kg(Builder $query): void
|
protected function kg(Builder $query): void
|
||||||
{
|
{
|
||||||
|
|||||||
@ -69,6 +69,7 @@ public function getForCreate(): array
|
|||||||
->with([
|
->with([
|
||||||
'rawMaterialPrices:id,raw_material_id,variant,price,stock',
|
'rawMaterialPrices:id,raw_material_id,variant,price,stock',
|
||||||
])
|
])
|
||||||
|
->active()
|
||||||
->orderBy('name')
|
->orderBy('name')
|
||||||
->get()
|
->get()
|
||||||
->each(function (RawMaterial $rawMaterial) {
|
->each(function (RawMaterial $rawMaterial) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user