MoneyCast::class, 'subtotal' => MoneyCast::class, 'tax_total' => MoneyCast::class, 'discount_total' => MoneyCast::class, 'total' => MoneyCast::class, ]; public function document(): BelongsTo { return $this->belongsTo(Document::class); } public function offering(): BelongsTo { return $this->belongsTo(Offering::class); } public function adjustments(): MorphToMany { return $this->morphToMany(Adjustment::class, 'adjustmentable', 'adjustmentables'); } public function salesTaxes(): MorphToMany { return $this->adjustments()->where('category', AdjustmentCategory::Tax)->where('type', AdjustmentType::Sales); } public function salesDiscounts(): MorphToMany { return $this->adjustments()->where('category', AdjustmentCategory::Discount)->where('type', AdjustmentType::Sales); } public function taxes(): MorphToMany { return $this->adjustments()->where('category', AdjustmentCategory::Tax); } public function discounts(): MorphToMany { return $this->adjustments()->where('category', AdjustmentCategory::Discount); } }