1 | <?php |
||
13 | class AllowedFilter |
||
14 | { |
||
15 | /** @var \Spatie\QueryBuilder\Filters\Filter */ |
||
16 | protected $filterClass; |
||
17 | |||
18 | /** @var string */ |
||
19 | protected $name; |
||
20 | |||
21 | /** @var string */ |
||
22 | protected $internalName; |
||
23 | |||
24 | /** @var \Illuminate\Support\Collection */ |
||
25 | protected $ignored; |
||
26 | |||
27 | /** @var mixed */ |
||
28 | protected $default; |
||
29 | |||
30 | public function __construct(string $name, Filter $filterClass, ?string $internalName = null) |
||
40 | |||
41 | public function filter(QueryBuilder $query, $value) |
||
51 | |||
52 | public static function setFilterArrayValueDelimiter(string $delimiter): void |
||
58 | |||
59 | public static function exact(string $name, ?string $internalName = null, bool $addRelationConstraint = true, string $arrayValueDelimiter = null): self |
||
64 | |||
65 | public static function partial(string $name, $internalName = null, bool $addRelationConstraint = true, string $arrayValueDelimiter = null): self |
||
70 | |||
71 | public static function scope(string $name, $internalName = null, string $arrayValueDelimiter = null): self |
||
76 | |||
77 | public static function callback(string $name, $callback, $internalName = null, string $arrayValueDelimiter = null): self |
||
82 | |||
83 | public static function trashed(string $name = 'trashed', $internalName = null): self |
||
87 | |||
88 | public static function custom(string $name, Filter $filterClass, $internalName = null, string $arrayValueDelimiter = null): self |
||
93 | |||
94 | public function getName(): string |
||
98 | |||
99 | public function isForFilter(string $filterName): bool |
||
103 | |||
104 | public function ignore(...$values): self |
||
112 | |||
113 | public function getIgnored(): array |
||
117 | |||
118 | public function getInternalName(): string |
||
122 | |||
123 | public function default($value): self |
||
129 | |||
130 | public function getDefault() |
||
134 | |||
135 | public function hasDefault(): bool |
||
139 | |||
140 | protected function resolveValueForFiltering($value) |
||
150 | } |
||
151 |