OfferingType::class, 'price' => MoneyCast::class, ]; public function incomeAccount(): BelongsTo { return $this->belongsTo(Account::class, 'income_account_id'); } public function expenseAccount(): BelongsTo { return $this->belongsTo(Account::class, 'expense_account_id'); } 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 purchaseTaxes(): MorphToMany { return $this->adjustments()->where('category', AdjustmentCategory::Tax)->where('type', AdjustmentType::Purchase); } public function salesDiscounts(): MorphToMany { return $this->adjustments()->where('category', AdjustmentCategory::Discount)->where('type', AdjustmentType::Sales); } public function purchaseDiscounts(): MorphToMany { return $this->adjustments()->where('category', AdjustmentCategory::Discount)->where('type', AdjustmentType::Purchase); } }