Number Filter
NumberFilter is specifically designed for numeric columns like prices, quantities, ages, or IDs. It renders a number input on the frontend and supports mathematical comparisons.
Basic Usage
Section titled “Basic Usage”By default, the NumberFilter provides mathematical operators to let users find exact or relative numeric values.
use Kinetics\Filters\NumberFilter;
NumberFilter::make('price')The available default operators are:
equals(Exact match)not_equals>(Greater than)>=(Greater than or equal to)<(Less than)<=(Less than or equal to)
Number Range (Min & Max)
Section titled “Number Range (Min & Max)”Just like the DateFilter, the NumberFilter also supports a powerful range() method.
This allows users to search for numbers between a minimum and maximum value simultaneously (for example, finding products priced between $50 and $100).
use Kinetics\Filters\NumberFilter;
NumberFilter::make('price')->range()When range() is enabled:
- The frontend UI transforms to accept two numeric inputs (Minimum and Maximum).
- The operator is forcefully set to
between. - The SQL query generated will use the
WHERE ... BETWEENlogic.
API Reference
Section titled “API Reference”| Method | Description |
|---|---|
make(string $key) | Creates a new filter instance. |
label(string $label) | Sets the filter label. |
column(string $column) | Specifies the database column name if different from the key. |
relation(string $relation, string $relationKey) | Explicitly sets the relationship to query. |
operators(array $operators) | Overrides the allowed operators for this filter. |