- How do I install codercms/filament-value-range-filter in a Laravel Filament project?
- Install it with Composer by running composer require codercms/filament-value-range-filter from your Laravel project root. As a Filament filter package it typically needs no manual service provider registration, thanks to Laravel package discovery. After installing, clear cached config and Filament assets if the filter does not appear immediately, and confirm the package is listed in composer.json.
- Which Filament and Laravel versions does this value range filter support?
- The package is built for Filament tables inside Laravel applications, so check its composer.json for the exact Filament, PHP, and Laravel constraints before installing. Match it to the Filament major version your admin panel uses, since Filament v2 and v3 filter APIs differ. If Composer reports a dependency conflict, adjust your Filament version rather than forcing the install with ignore-platform-reqs.
- How do I add the value range filter to a Filament table?
- Register the filter in your table's filters array, typically with a call such as ValueRangeFilter::make('price'), where the argument is the numeric column you want to constrain. Filament then renders min and max inputs in the filter panel and applies the selected range to the table query. Use the exact column name from your model's database table.
- Can I filter by a custom column or a relationship column?
- Range filters work best against a real, queryable numeric column on the table's base query. For relationship values you generally need a custom constraint, such as a whereHas clause or a joined and aggregated column, because a plain column name will not resolve through the relationship. If the package exposes a query callback or customization hook, use it to add your own where condition.
- How does the min/max range filter handle empty or invalid input?
- An empty min or max field is normally treated as an open-ended bound, so users can filter only above or only below a value. When both fields are blank, Filament filters usually skip the constraint entirely and leave the table unfiltered. Non-numeric input should be rejected by the form component or coerced safely, so add stricter validation rules if your data requires it.
- Does the filter work with existing Filament filters and query scopes?
- The filter adds its own where constraint to the table query, so it composes with other Filament filters and with base query scopes you already apply. Each filter contributes an independent condition, so application order is rarely an issue. Test combined filters if your table uses joins, grouped conditions, or soft-delete scopes that could interact with the range constraint.
- Can I customize the labels, placeholders, and default range values?
- Filament filters support standard label customization, and depending on the package's form schema you can usually adjust the min and max field labels or placeholders as well. Default state can often be set through the filter's form configuration or by passing initial values. Check the package README for the exact fluent methods it exposes before relying on a specific option.
- How do I test the value range filter in my Laravel application?
- Use Pest or PHPUnit with Filament's Livewire table testing helpers to apply filter state and assert the resulting query or visible rows. Cover the bounded cases, min only, max only, and both values, plus the unfiltered case where both inputs are empty. Asserting the generated SQL or returned records catches regressions when you upgrade Filament.
- Are there production performance concerns when filtering large tables?
- The filter becomes a WHERE condition on your numeric column, so add a database index on columns users filter frequently, especially on large tables. Avoid filtering on computed or relationship-derived values at scale without checking the query plan. Also confirm the bounds are passed as bound parameters rather than concatenated into raw SQL.
- What alternatives exist if this package does not fit my filtering needs?
- Newer Filament versions include built-in filters, including range and query-builder style options, so compare those before adding a dependency. If you need multi-column ranges or a highly custom UI, writing a custom Filament filter class may be easier to maintain. This package is a good fit when you want a ready-made min/max numeric filter with minimal setup.