trait Filters

Properties

Collection|array $filters

Collection of defined filters.

bool $has_filters
bool $show_filters

Methods

void
setFilters()

Initialize filters.

string
getColumnKey(string $filter_label)

Identify the column key from a filter label.

void
updatedFilters(string $key, mixed $value)

Handle updates to filter inputs.

Collection
applyFilters(Collection $data)

Apply filters to the data collection (Array/Collection mode).

Collection
getFreshFilters()

Get a fresh instance of filters with current state merged.

Builder
applyFiltersToQuery(Builder $query)

Apply filters to the Eloquent query.

void
clearAllFilters(bool $selectAll = false)

Clear all active filters and search.

Details

at line 35
void setFilters()

Initialize filters.

Processes defined filters, resolving keys, options (for magic-select), and serializing them for Livewire.

Return Value

void

at line 154
string getColumnKey(string $filter_label)

Identify the column key from a filter label.

Parameters

string $filter_label

Return Value

string

Exceptions

Exception

at line 174
void updatedFilters(string $key, mixed $value)

Handle updates to filter inputs.

Triggered by Livewire when filter properties change.

Parameters

string $key
mixed $value

Return Value

void

at line 219
Collection applyFilters(Collection $data)

Apply filters to the data collection (Array/Collection mode).

Parameters

Collection $data

Return Value

Collection

at line 276
Collection getFreshFilters()

Get a fresh instance of filters with current state merged.

Re-initializes filters (e.g. to get closures back) and merges the Livewire state (inputs).

Return Value

Collection

at line 317
Builder applyFiltersToQuery(Builder $query)

Apply filters to the Eloquent query.

Parameters

Builder $query

Return Value

Builder

at line 416
void clearAllFilters(bool $selectAll = false)

Clear all active filters and search.

Parameters

bool $selectAll

Whether to select all data after clearing.

Return Value

void