OrderChannel::class, 'price_type' => PriceType::class, 'status' => OrderStatus::class, 'subtotal' => 'integer', 'discount' => 'integer', 'marketplace_fee' => 'integer', 'net_amount' => 'integer', ]; } public function subtotalFormatted(): Attribute { return Attribute::make( get: fn () => 'Rp '.number_format($this->subtotal, 0, ',', '.'), ); } public function discountFormatted(): Attribute { return Attribute::make( get: fn () => 'Rp '.number_format($this->discount, 0, ',', '.'), ); } public function marketplaceFeeFormatted(): Attribute { return Attribute::make( get: fn () => 'Rp '.number_format($this->marketplace_fee, 0, ',', '.'), ); } public function netAmountFormatted(): Attribute { return Attribute::make( get: fn () => 'Rp '.number_format($this->net_amount, 0, ',', '.'), ); } public function createdAtFormatted(): Attribute { return Attribute::make( get: fn () => $this->created_at?->translatedFormat('l, d F Y H:i'), ); } public function channelLabel(): Attribute { return Attribute::make( get: fn () => $this->channel->label(), ); } public function priceTypeLabel(): Attribute { return Attribute::make( get: fn () => $this->price_type->label(), ); } public function statusLabel(): Attribute { return Attribute::make( get: fn () => $this->status->label(), ); } public function customer(): BelongsTo { return $this->belongsTo(Customer::class); } public function items(): HasMany { return $this->hasMany(OrderItem::class); } public function cashTransaction(): BelongsTo { return $this->belongsTo(CashTransaction::class); } public function createdBy(): BelongsTo { return $this->belongsTo(User::class, 'created_by_id'); } }