'date', 'amount' => 'decimal:2', ]; public function chartOfAccount(): BelongsTo { return $this->belongsTo(ChartOfAccount::class); } public function currency(): BelongsTo { return $this->belongsTo(Currency::class); } public function creator(): BelongsTo { return $this->belongsTo(User::class, 'created_by'); } public function scopeIncome($query) { return $query->whereHas('chartOfAccount', function ($q) { $q->where('type', 'income'); }); } public function scopeExpense($query) { return $query->whereHas('chartOfAccount', function ($q) { $q->where('type', 'expense'); }); } }