Skip to content

Firefly III: a personal finances manager

Return amount as string

James Cole75ea1c4f4b11
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,
+ );
+ }
}