2024-05-12 06:24:11 +02:00
|
|
|
<?php
|
|
|
|
|
2024-05-13 05:10:16 +02:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2024-05-12 06:24:11 +02:00
|
|
|
namespace FireflyIII\Models;
|
|
|
|
|
2024-11-09 12:19:01 +01:00
|
|
|
use FireflyIII\Casts\SeparateTimezoneCaster;
|
2024-05-12 06:24:11 +02:00
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2024-05-12 06:25:13 +02:00
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
2024-05-12 06:24:11 +02:00
|
|
|
|
2024-07-31 08:26:43 +02:00
|
|
|
/**
|
|
|
|
* @mixin IdeHelperAccountBalance
|
|
|
|
*/
|
2024-05-12 06:24:11 +02:00
|
|
|
class AccountBalance extends Model
|
|
|
|
{
|
|
|
|
use HasFactory;
|
2024-11-06 12:01:29 +01:00
|
|
|
protected $fillable = ['account_id', 'title', 'transaction_currency_id', 'balance', 'date', 'date_tz'];
|
2024-05-12 06:25:13 +02:00
|
|
|
|
2024-11-09 12:19:01 +01:00
|
|
|
protected function casts(): array
|
|
|
|
{
|
|
|
|
return [
|
2024-11-18 04:18:51 +01:00
|
|
|
'date' => SeparateTimezoneCaster::class,
|
2024-11-15 19:13:37 +01:00
|
|
|
'balance' => 'string',
|
2024-11-09 12:19:01 +01:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2024-05-12 06:25:13 +02:00
|
|
|
public function account(): BelongsTo
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Account::class);
|
|
|
|
}
|
2024-05-12 13:31:33 +02:00
|
|
|
|
|
|
|
public function transactionCurrency(): BelongsTo
|
|
|
|
{
|
|
|
|
return $this->belongsTo(TransactionCurrency::class);
|
|
|
|
}
|
2024-05-12 06:24:11 +02:00
|
|
|
}
|