FieldSelectFilter
class FieldSelectFilter extends BasicFilter (View source)
This filter shows a select of available options of a certain field.
For example, you have a model with a year field, this filter will collect the values and use those to make the filter.
Constants
OPTION_ALL |
|
OPTION_NOT_SET |
The option not set allows to filter by "null" values. |
Properties
protected string|null | $label | from TwillBaseFilter | |
protected string|null | $queryString | from TwillBaseFilter | |
protected bool | $enabled | from TwillBaseFilter | |
protected Closure|null | $apply | from TwillBaseFilter | |
protected Collection|null | $options | from BasicFilter | |
protected mixed | $appliedValue | from BasicFilter | |
protected bool | $includeAll | from BasicFilter | |
protected mixed | $default | from BasicFilter | |
protected string | $field |
Methods
No description
Set the query string to use in the url
When passing a boolean, the filter will only be enabled when it is true.
When passing a boolean, the filter will be disabled when it is true.
This removes the "All" option.
Sets the options that can be used to select, it should be a key->value collection.
No description
This adds the "Without value" option if there are result with "null" value.
Details
Builder
applyFilter(Builder $builder)
No description
final
__construct()
No description
static TwillBaseFilter
make()
No description
TwillBaseFilter
label(string $label)
Set a label to use for the filter.
string|null
getLabel()
No description
TwillBaseFilter
queryString(string $queryString)
Set the query string to use in the url
string
getQueryString()
No description
TwillBaseFilter
onlyEnableWhen(bool $enable = true)
When passing a boolean, the filter will only be enabled when it is true.
TwillBaseFilter
disable(bool $disable = true)
When passing a boolean, the filter will be disabled when it is true.
TwillBaseFilter
apply(Closure $closure)
The closure to apply the filter.
bool
isEnabled()
No description
BasicFilter
withFilterValue(mixed $value)
Sets the applied value of the filter.
This is usually something you do not want to run manually.
BasicFilter
withoutIncludeAll(bool $removeIncludeAll = true)
This removes the "All" option.
BasicFilter
options(Collection $options)
Sets the options that can be used to select, it should be a key->value collection.
BasicFilter
default(mixed $default)
Set the default value of the filter.
mixed
getDefaultValue()
No description
string
getKey()
No description
Collection
getOptions(ModuleRepository $repository)
No description
FieldSelectFilter
field(string $fieldName)
No description
FieldSelectFilter
withWithoutValueOption(bool $withoutValueOption = true)
This adds the "Without value" option if there are result with "null" value.