Filters API Reference
Zonvoir\InertiaTablePro\Filters\Filter is the abstract base class for table filter definitions in Zonvoir Table.
PHP Traits: HasFilters & HasProFeatures
Section titled “PHP Traits: HasFilters & HasProFeatures”| Trait | Best For | What it Includes |
|---|---|---|
| Zonvoir\InertiaTablePro\Concerns\HasFilters | Tables needing only filters | Standalone filter builder, URL query state serialization, query clause execution |
| Zonvoir\InertiaTablePro\Concerns\HasProFeatures | Tables needing all Pro features | Includes HasFilters + HasColumnPersistence (filters + column reordering & database persistence) |
Class Summary
Section titled “Class Summary”| Item | Value |
|---|---|
| Class | Zonvoir\InertiaTablePro\Filters\Filter |
| Type | abstract class |
| Concrete Classes | TextFilter, NumericFilter, SetFilter, DateFilter, DateTimeFilter, BooleanFilter |
| Factory Methods | make(), create() |
Filter Types
Section titled “Filter Types”| Filter Class | Serialized Type | Description |
|---|---|---|
TextFilter |
'text' |
String attributes with contains, starts_with, ends_with, and exact match clauses |
NumericFilter |
'numeric' |
Numbers with comparisons (>, <, >=, <=), range (between), and equality |
SetFilter |
'set' |
Predefined options, multi-select, search, lazy loading, and model/relation plucking |
DateFilter |
'date' |
Date comparisons (before, after, between, equals) |
DateTimeFilter |
'datetime' |
Timestamp comparisons with precision |
BooleanFilter |
'boolean' |
True / false / null boolean filtering |
Base Filter Methods
Section titled “Base Filter Methods”make()
Signature
public static function make(
string $name,
string|callable|null $label = null,
?string $key = null,
bool $nullable = false,
bool $wrapped = true,
?array $comparators = null,
mixed $default = null,
string|Comparator|null $defaultComparator = null,
?callable $apply = null,
?array $clauses = null,
bool $applyUnwrapped = false,
?callable $applyUsing = null,
?callable $validateUsing = null,
?array $meta = null,
?string $component = null,
): static
Create a new filter definition instance.
create()
Signature
public static function create(...$args): static
Alias of make().
key()
Signature
public function key(string $key): static
Explicitly configure the query parameter and serialization key.
label()
Signature
public function label(?string $label): static
Set the human-readable display label for the filter.
clauses()
Signature
public function clauses(array $clauses): static
Configure the allowed clauses/comparators for this filter. Alias of comparators().
default()
Signature
public function default(mixed $value, string|Comparator|Clause|null $comparator = null): static
Set the default value and optional default clause.
nullable()
Signature
public function nullable(bool $nullable = true): static
Allow the filter to explicitly match null values in the database.
validateUsing()
Signature
public function validateUsing(callable $callback): static
Validate or mutate the filter value before query execution. Accepts ($value, $clause, $query). Returning null skips applying the filter.
applyUsing()
Signature
public function applyUsing(callable $callback, bool $applyUnwrapped = false): static
Override the default query callback. Supports 4-argument signature ($query, $attribute, $clause, $value) or 3-argument signature ($query, $value, $clause).
applyUnwrapped()
Signature
public function applyUnwrapped(bool $unwrapped = true): static
Prevent wrapping the filter conditions in a nested where() closure.
meta()
Signature
public function meta(array $meta): static
Attach custom metadata array serialized into the filter definition payload.
component()
Signature
public function component(string $component): static
Specify the name of a custom Vue component used to render the filter editor.
TextFilter
Section titled “TextFilter”| Item | Value |
|---|---|
| Class | Zonvoir\InertiaTablePro\Filters\TextFilter |
| Serialized type | 'text' |
| Default clauses | Equals, NotEquals, Contains, DoesNotContain, StartsWith, EndsWith |
TextFilter inherits all base filter methods and does not add type-specific fluent methods. Values must be strings, except that a nullable filter can use null with Equals or NotEquals.
NumericFilter
Section titled “NumericFilter”| Item | Value |
|---|---|
| Class | Zonvoir\InertiaTablePro\Filters\NumericFilter |
| Serialized type | 'numeric' |
| Default clauses | Equals, NotEquals, GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual, Between |
NumericFilter inherits all base filter methods. It accepts finite integers, floats, and numeric strings. Between requires two values in ascending order.
BooleanFilter
Section titled “BooleanFilter”| Item | Value |
|---|---|
| Class | Zonvoir\InertiaTablePro\Filters\BooleanFilter |
| Serialized type | 'boolean' |
| Default clauses | Equals, NotEquals |
BooleanFilter inherits all base filter methods. It normalizes true, false, 1, 0, '1', '0', 'true', and 'false' to booleans before applying the query.
SetFilter Methods
Section titled “SetFilter Methods”| Item | Value |
|---|---|
| Class | Zonvoir\InertiaTablePro\Filters\SetFilter |
| Serialized type | 'set' |
| Default clauses | Equals, NotEquals, In, NotIn |
options()
Signature
public function options(array $options): static
Provide an associative array of [value => label] options for the set filter.
withoutClause()
Signature
public function withoutClause(bool $withoutClause = true): static
Hide the clause dropdown in the UI and default the filter to Clause::Equals.
multiple()
Signature
public function multiple(bool $multiple = true): static
Enable multi-select mode, allowing multiple values to be selected simultaneously.
searchable()
Signature
public function searchable(bool $searchable = true): static
Add a client-side search field to the set filter's option dropdown.
lazy()
Signature
public function lazy(bool $lazy = true): static
Defer option resolution until requested by the frontend.
pluckOptionsFromModel()
Signature
public function pluckOptionsFromModel(string $modelClass, string $labelColumn = 'name', string $valueColumn = 'id'): static
Dynamically pluck options from an Eloquent model query.
pluckOptionsFromRelation()
Signature
public function pluckOptionsFromRelation(string $labelColumn = 'name', ?string $valueColumn = null, ?string $modelClass = null): static
Dynamically pluck options from the related Eloquent relationship.
DateFilter Methods
Section titled “DateFilter Methods”| Item | Value |
|---|---|
| Class | Zonvoir\InertiaTablePro\Filters\DateFilter |
| Serialized type | 'date', or 'datetime' after withTime() |
| Default clauses | Equals, NotEquals, Before, After, OnOrBefore, OnOrAfter, Between |
withTime()
Signature
public function withTime(bool $time24h = false): static
Enable time selection and serialize the filter as datetime. Pass true for a 24-hour input.
presets()
Signature
public function presets(array $presets): static
Configure named date or date-range shortcuts as label => value pairs.
timezone()
Signature
public function timezone(DateTimeZone|string $timezone): static
Set the timezone used to interpret filter values before querying.
browserTimezone()
Signature
public function browserTimezone(bool $browser = true): static
Use timezone information supplied by the browser.
minDate()
Signature
public function minDate(string|DateTimeInterface $minDate): static
Set the earliest value accepted by the UI and backend validator.
maxDate()
Signature
public function maxDate(string|DateTimeInterface $maxDate): static
Set the latest value accepted by the UI and backend validator.
numberOfMonths()
Signature
public function numberOfMonths(int $numberOfMonths = 2): static
Set the number of calendar months displayed, with a minimum of one.
showWeekNumbers()
Signature
public function showWeekNumbers(bool $show = true): static
Show or hide calendar week numbers.
weekStartsOn()
Signature
public function weekStartsOn(int $day = 0): static
Set the first weekday from 0 (Sunday) through 6 (Saturday).
clearable()
Signature
public function clearable(bool $clearable = true): static
Allow the current picker value to be cleared.
DateTimeFilter
Section titled “DateTimeFilter”| Item | Value |
|---|---|
| Class | Zonvoir\InertiaTablePro\Filters\DateTimeFilter |
| Serialized type | 'datetime' |
| Default clauses | Equals, NotEquals, Before, After, OnOrBefore, OnOrAfter, Between |
DateTimeFilter extends DateFilter and enables time selection during construction. It supports every DateFilter method.
Clause / Comparator Enum
Section titled “Clause / Comparator Enum”Zonvoir\InertiaTablePro\Enums\Clause is an alias of Comparator.
| Case | Value | Min Values | Max Values | Description |
|---|---|---|---|---|
Clause::Equals |
'equals' |
1 | 1 | Exact match |
Clause::NotEquals |
'not_equals' |
1 | 1 | Not equal |
Clause::Contains |
'contains' |
1 | 1 | Substring match |
Clause::DoesNotContain |
'does_not_contain' |
1 | 1 | Excludes substring |
Clause::StartsWith |
'starts_with' |
1 | 1 | Prefix match |
Clause::EndsWith |
'ends_with' |
1 | 1 | Suffix match |
Clause::GreaterThan |
'greater_than' |
1 | 1 | Greater than |
Clause::GreaterThanOrEqual |
'greater_than_or_equal' |
1 | 1 | Greater than or equal |
Clause::LessThan |
'less_than' |
1 | 1 | Less than |
Clause::LessThanOrEqual |
'less_than_or_equal' |
1 | 1 | Less than or equal |
Clause::Between |
'between' |
2 | 2 | Value within inclusive range |
Clause::NotBetween |
'not_between' |
2 | 2 | Value outside range |
Clause::In |
'in' |
1 | null |
Value in array |
Clause::NotIn |
'not_in' |
1 | null |
Value not in array |
Clause::IsSet |
'is_set' |
0 | 0 | Column has non-null value |
Clause::IsNotSet |
'is_not_set' |
0 | 0 | Column is null or blank |
Frontend Vue API Reference
Section titled “Frontend Vue API Reference”Filter components and composables are exported directly by @zonvoir/inertia-table-vue:
import { setClauseSymbols, getClauseSymbol, resetClauseSymbols, useTableFilters, TableFilterButton, TableFilterDrawer, TableFilterHeader, TableFilterPanel, ActiveFilters, TextFilter, NumericFilter, SetFilter, DateFilter, BooleanFilter,} from '@zonvoir/inertia-table-vue';Methods
Section titled “Methods”| Function | Signature | Description |
|---|---|---|
setClauseSymbols() |
(symbols: Record<string, string>) => void |
Register custom symbols for filter clauses in header pills. |
getClauseSymbol() |
(key: string) => string | undefined |
Retrieve the symbol configured for a clause. |
resetClauseSymbols() |
() => void |
Clear custom clause symbols and restore default labels. |
useTableFilters() |
(table, options?) => UseTableFiltersReturn |
Filter management composable powering table filter states. |
Filter Slots
Section titled “Filter Slots”| Slot | Scope Props | Description |
|---|---|---|
filter-button |
table, open, toggle, table-api |
Replaces the filter toggle button in the toolbar. |
filter-panel |
table, open, close, table-api |
Replaces the entire slide-out filter panel / sidebar container. |
filters |
table, open, close, layout, table-api |
Container wrapper slot around filter-panel. |
filter-header |
table, open, close, table-api |
Replaces the horizontal filter bar in header layout. |
filter(attribute) |
filter, value, update, table, close |
Replaces the editor input for a specific filter attribute. |
For detailed examples, see the Vue Slots Guide.