-
app/Traits/AmountFormatter.php
Open in GitHubuse App\Helpers\MoneyHelper; use App\Models\Settings\Currency; use Illuminate\Database\Eloquent\Relations\BelongsTo; trait AmountFormatter { public function currency() { return $this->belongsTo(Currency::class); } public function setAmountAttribute($value) { $this->attributes['amount'] = MoneyHelper::parseInput($value, $this->currency); } // }
-
app/Models/Contact/Debt.php
Open in GitHubuse App\Traits\AmountFormatter; class Debt extends Model { use AmountFormatter; // }
-
resources/views/people/debt/form.blade.php
Open in GitHub// {{-- Amount --}} <div class="form-group"> <label for="amount">{{ trans('people.debt_add_amount') }} ({{ Auth::user()->currency->symbol }})</label> <input type="number" step=".01" class="form-control" name="amount" id="amount" maxlength="254" value="{{ old('amount') ?? $debt->amount }}" autofocus required> </div> //