diff --git a/app/Models/Bill.php b/app/Models/Bill.php index ecd0cc1d7b..3d76819c94 100644 --- a/app/Models/Bill.php +++ b/app/Models/Bill.php @@ -24,6 +24,7 @@ namespace FireflyIII\Models; use Eloquent; use FireflyIII\User; +use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; @@ -223,4 +224,28 @@ class Bill extends Model { return $this->belongsTo(User::class); } + + /** + * Get the max amount + * + * @return Attribute + */ + protected function amountMax(): Attribute + { + return Attribute::make( + get: fn($value) => (string) $value, + ); + } + + /** + * Get the min amount + * + * @return Attribute + */ + protected function amountMin(): Attribute + { + return Attribute::make( + get: fn($value) => (string) $value, + ); + } } diff --git a/app/Models/BudgetLimit.php b/app/Models/BudgetLimit.php index 2c398d4223..aff5ed5157 100644 --- a/app/Models/BudgetLimit.php +++ b/app/Models/BudgetLimit.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; @@ -119,4 +120,16 @@ class BudgetLimit extends Model { return $this->belongsTo(TransactionCurrency::class); } + + /** + * Get the amount + * + * @return Attribute + */ + protected function amount(): Attribute + { + return Attribute::make( + get: fn($value) => (string) $value, + ); + } } diff --git a/app/Models/Transaction.php b/app/Models/Transaction.php index 58d4d9a6cf..346a521db7 100644 --- a/app/Models/Transaction.php +++ b/app/Models/Transaction.php @@ -25,6 +25,7 @@ namespace FireflyIII\Models; use Carbon\Carbon; use Eloquent; use Illuminate\Database\Eloquent\Builder; +use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; @@ -256,4 +257,28 @@ class Transaction extends Model { return $this->belongsTo(TransactionJournal::class); } + + /** + * Get the amount + * + * @return Attribute + */ + protected function amount(): Attribute + { + return Attribute::make( + get: fn($value) => (string) $value, + ); + } + + /** + * Get the foreign amount + * + * @return Attribute + */ + protected function foreignAmount(): Attribute + { + return Attribute::make( + get: fn($value) => (string) $value, + ); + } } diff --git a/app/Support/Steam.php b/app/Support/Steam.php index 1f2ebc9777..a74f16a2b9 100644 --- a/app/Support/Steam.php +++ b/app/Support/Steam.php @@ -338,7 +338,7 @@ class Steam $return = []; /** @var stdClass $entry */ foreach ($balances as $entry) { - $return[(int) $entry->transaction_currency_id] = $entry->sum_for_currency; + $return[(int) $entry->transaction_currency_id] = (string) $entry->sum_for_currency; } $cache->store($return);