PriceType::class, 'price' => 'integer', ]; } protected function formattedPrice(): Attribute { return Attribute::make( get: fn () => 'Rp ' . number_format($this->price, 0, ',', '.'), ); } #[Scope] protected function retail(Builder $query): void { $query->where('type', PriceType::RETAIL); } #[Scope] protected function wholesale(Builder $query): void { $query->where('type', PriceType::WHOLESALE); } public function variant(): BelongsTo { return $this->belongsTo(ProductVariant::class, 'variant_id'); } protected function typeLabel(): Attribute { return Attribute::make( get: fn () => $this->type->label(), ); } }