diff --git a/app/Models/PiggyBank.php b/app/Models/PiggyBank.php index 3526816a63..75f15272b7 100644 --- a/app/Models/PiggyBank.php +++ b/app/Models/PiggyBank.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Models; use Eloquent; +use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; @@ -154,7 +155,7 @@ class PiggyBank extends Model } /** - * Get all of the tags for the post. + * Get all the tags for the post. */ public function objectGroups() { @@ -188,4 +189,16 @@ class PiggyBank extends Model { $this->attributes['targetamount'] = (string) $value; } + + /** + * Get the max amount + * + * @return Attribute + */ + protected function targetamount(): Attribute + { + return Attribute::make( + get: fn($value) => (string) $value, + ); + } }