'date', 'end_date' => 'date', 'allocated_amount' => 'integer', 'carried_over_amount' => 'integer', 'processing_historical' => 'boolean', 'close_to_limit_notified' => 'boolean', 'over_limit_notified' => 'boolean', ]; } /** @return BelongsTo */ public function budget(): BelongsTo { return $this->belongsTo(Budget::class); } /** * Total spent in this period, in cents. BudgetTransaction amounts are * stored positive for expenses, so summing them gives the amount spent. */ public function spentAmount(): int { return (int) $this->budgetTransactions()->sum('amount'); } /** @return HasMany */ public function budgetTransactions(): HasMany { return $this->hasMany(BudgetTransaction::class); } }