Introduction
Basics
- Installation
- Make Model Filterable
- Filtering Models
- Allowing Filters
- Relationships
Available Filters
- Full Filter List
- Field Filters
- Relation Filters
- Morph Relation Filters
- Condition Filters
Digging Deeper
Digging Deeper
Allowed Types
Overview
When specifying an allowed filter, you should specify the type of filters to be allowed.
Example: Only $eq
Allowed
use IndexZer0\EloquentFiltering\Filter\Filterable\Filter;
use IndexZer0\EloquentFiltering\Filter\Types\Types;
use IndexZer0\EloquentFiltering\Filter\FilterType;
// By enum
Filter::field('name', [FilterType::EQUAL])
Filter::field('name', Types::only([FilterType::EQUAL]))
// By string
Filter::field('name', ['$eq'])
Filter::field('name', Types::only(['$eq']))
Example: Multiple types Allowed
use IndexZer0\EloquentFiltering\Filter\Filterable\Filter;
use IndexZer0\EloquentFiltering\Filter\Types\Types;
use IndexZer0\EloquentFiltering\Filter\FilterType;
Filter::field('name', [FilterType::EQUAL, FilterType::IN, '$yourCustomFilter'])
Example: All Types Allowed
use IndexZer0\EloquentFiltering\Filter\Filterable\Filter;
use IndexZer0\EloquentFiltering\Filter\Types\Types;
Filter::field('name', Types::all())
Assistant
Responses are generated using AI and may contain mistakes.