ProductStockQuality::class, 'subtotal' => 'integer', 'total' => 'integer', ]; } protected function stockTypeLabel(): Attribute { return Attribute::make( get: fn () => $this->stock_type->label(), ); } protected function formattedSubtotal(): Attribute { return Attribute::make( get: fn () => 'Rp ' . number_format($this->subtotal, 0, ',', '.'), ); } protected function formattedTotal(): Attribute { return Attribute::make( get: fn () => 'Rp ' . number_format($this->total, 0, ',', '.'), ); } #[Scope] protected function good(Builder $query): void { $query->where('stock_type', ProductStockQuality::GOOD); } #[Scope] protected function reject(Builder $query): void { $query->where('stock_type', ProductStockQuality::REJECT); } public function createdBy(): BelongsTo { return $this->belongsTo(User::class, 'created_by_id'); } public function restockItems(): HasMany { return $this->hasMany(RestockItem::class); } }