Add running balance

This commit is contained in:
James Cole
2024-07-29 19:51:04 +02:00
parent 2df4b40a28
commit 51958af422
4 changed files with 208 additions and 25 deletions

View File

@@ -108,6 +108,7 @@ class Transaction extends Model
'encrypted' => 'boolean', // model does not have these fields though
'bill_name_encrypted' => 'boolean',
'reconciled' => 'boolean',
'balance_dirty' => 'boolean',
'date' => 'datetime',
];
@@ -233,6 +234,13 @@ class Transaction extends Model
);
}
protected function balanceDirty(): Attribute
{
return Attribute::make(
get: static fn ($value) => (int)$value === 1,
);
}
/**
* Get the amount
*/