Add related models.

This commit is contained in:
James Cole 2024-05-12 06:25:13 +02:00
parent cebfaa32bf
commit c741b2a819
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80
2 changed files with 12 additions and 0 deletions

View File

@ -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;

View File

@ -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);
}
}