diff --git a/app/Models/Account.php b/app/Models/Account.php index f6182fad25..df6f4ae9c4 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -193,6 +193,11 @@ class Account extends Model return $this->hasMany(AccountMeta::class); } + public function accountBalances(): HasMany + { + return $this->hasMany(AccountBalance::class); + } + public function getEditNameAttribute(): string { $name = $this->name; diff --git a/app/Models/AccountBalance.php b/app/Models/AccountBalance.php index d718af79d7..f3a180d728 100644 --- a/app/Models/AccountBalance.php +++ b/app/Models/AccountBalance.php @@ -4,9 +4,16 @@ namespace FireflyIII\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; class AccountBalance extends Model { protected $fillable = ['account_id', 'transaction_currency_id', 'balance']; use HasFactory; + + + public function account(): BelongsTo + { + return $this->belongsTo(Account::class); + } }