class FilterState extends AbstractQueryState

Properties

protected Builder $query from AbstractQueryState
protected User $actor from AbstractQueryState
protected mixed $defaultSort from AbstractQueryState
protected FilterInterface[] $activeFilters

Methods

__construct(Builder $query, User $actor, $defaultSort = [])

No description

Builder
getQuery()

Get the query builder for the search results query.

getActor()

Get the user who is performing the search.

array
getDefaultSort()

Get the default sort order for the search.

mixed
setDefaultSort(mixed $defaultSort)

Set the default sort order for the search. This will only be applied if a sort order has not been specified in the search criteria.

getActiveFilters()

Get a list of the filters that are active.

void
addActiveFilter(FilterInterface $filter)

Add a filter as being active.

Details

__construct(Builder $query, User $actor, $defaultSort = [])

Parameters

Builder $query
User $actor
$defaultSort

Builder getQuery()

Get the query builder for the search results query.

Return Value

Builder

User getActor()

Get the user who is performing the search.

Return Value

User

array getDefaultSort()

Get the default sort order for the search.

Return Value

array

mixed setDefaultSort(mixed $defaultSort)

Set the default sort order for the search. This will only be applied if a sort order has not been specified in the search criteria.

Parameters

mixed $defaultSort An array of sort-order pairs, where the column is the key, and the order is the value. The order may be 'asc', 'desc', or an array of IDs to order by. Alternatively, a callable may be used.

Return Value

mixed

FilterInterface[] getActiveFilters()

Get a list of the filters that are active.

Return Value

FilterInterface[]

void addActiveFilter(FilterInterface $filter)

Add a filter as being active.

Parameters

FilterInterface $filter

Return Value

void