- How do I install the BRL money field for Filament?
- Install it with Composer using composer require a21ns1g4ts/filament-brl-money-field. Because it is a Filament plugin-style field, no service provider registration is usually needed beyond Composer autoloading, but check the repository README for any publish or asset steps. Commit your composer.json and composer.lock changes so other environments get the same version.
- Which Filament and Laravel versions does filament-brl-money-field support?
- The package targets Filament admin panels and is installed as a form field component, so its compatibility depends on the Filament major version declared in its composer.json. Before upgrading Filament, check the require constraints in the package repository and test your forms on a branch. If your project runs an older Filament release, pin the package version that matches it.
- How do I add a BRL money field to a Filament resource form?
- Import the field class and add it to your form schema like any other Filament component, giving it a name that matches your model attribute. It then renders a Brazilian Real input with currency formatting applied as the user types. You can chain standard Filament methods such as label, required, and helperText to match the rest of your form.
- Does the field store values in cents or as a decimal in the database?
- The field handles the input and display layer, formatting the number as Brazilian Real while the user types. Your form state should be persisted to a decimal column and cast in Eloquent, for example with a decimal:2 cast, so arithmetic stays reliable. Avoid storing formatted strings with separators in the database, since that breaks aggregation and reporting queries.
- Can I use this package for USD, EUR, or other currencies?
- No, it is purpose-built for Brazilian Real, using the R$ symbol and Brazilian thousand and decimal separators. For other currencies you are better off with a generic masked input or a money package that supports configurable locale and symbol. If you only need a one-off case, Filament's TextInput with prefix and mask options may be enough.
- How do I validate BRL money input in Filament?
- Attach standard Filament validation methods to the field, such as required, numeric, minValue, and maxValue, plus custom rules via the rules method. Because the field presents formatted currency, make sure your rules target the underlying numeric value rather than the masked string. Add a clear validation message so users understand the expected range.
- Does the money field work with Livewire reactive forms and dependent fields?
- Yes. Filament forms are Livewire components, so the field works with reactive and live validation like other inputs. You can listen for its state changes to update totals, discounts, or payment summaries elsewhere in the form. Keep an eye on debounce settings if you recalculate totals on every keystroke.
- How do I test a Filament form that uses the BRL money field?
- Use Livewire testing helpers on the Filament page class, filling the form with the field name and the value your field expects, then calling the create or save action and asserting the database state. Because currency formatting can transform the value, assert against the numeric value persisted rather than the formatted display string. A feature test that posts the form and checks the stored decimal is usually sufficient.
- Is a21ns1g4ts/filament-brl-money-field safe to use in production?
- It is a small, focused field package, so the main checks are recent commits, open issues, and whether its Filament constraint matches your project. Pin a specific version in composer.lock and cover the money input with at least one feature test so a future update cannot silently change how values are parsed. For critical financial flows, review the source, since currency parsing edge cases matter.
- What are the alternatives to this package for money fields in Filament?
- You can build the same behaviour with Filament's built-in TextInput using a mask, prefix, and formatStateUsing callbacks, which avoids an extra dependency. Broader money packages and general mask libraries also exist if you need multiple currencies or locales. Choose this package when you want BRL formatting handled for you and your admin panel is Brazil-focused.