From 75ea1c4f4b11dc227f2cf60e8aa15b14b483f3ec Mon Sep 17 00:00:00 2001 From: James Cole Date: Mon, 1 Aug 2022 19:51:45 +0200 Subject: [PATCH] Return amount as string --- app/Models/PiggyBankEvent.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/Models/PiggyBankEvent.php b/app/Models/PiggyBankEvent.php index 0429630ee8..94d28acc35 100644 --- a/app/Models/PiggyBankEvent.php +++ b/app/Models/PiggyBankEvent.php @@ -24,6 +24,7 @@ namespace FireflyIII\Models; use Eloquent; use Illuminate\Database\Eloquent\Builder; +use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Support\Carbon; @@ -97,4 +98,16 @@ class PiggyBankEvent extends Model { return $this->belongsTo(TransactionJournal::class); } + + /** + * Get the amount + * + * @return Attribute + */ + protected function amount(): Attribute + { + return Attribute::make( + get: fn($value) => (string) $value, + ); + } }