RawMaterialUnit::class, 'is_active' => 'boolean', ]; } protected function formattedName(): Attribute { return Attribute::make( get: fn () => ucfirst($this->name), ); } protected function unitLabel(): Attribute { return Attribute::make( get: fn () => $this->unit->label(), ); } #[Scope] protected function kg(Builder $query): void { $query->where('unit', RawMaterialUnit::KG); } #[Scope] protected function meter(Builder $query): void { $query->where('unit', RawMaterialUnit::METER); } #[Scope] protected function yard(Builder $query): void { $query->where('unit', RawMaterialUnit::YARD); } public function rawMaterialPrices(): HasMany { return $this->hasMany(RawMaterialPrice::class); } }