1 | <?php |
||
12 | class Filter |
||
13 | { |
||
14 | /** @var string|\Spatie\QueryBuilder\Filters\Filter */ |
||
15 | protected $filterClass; |
||
16 | |||
17 | /** @var string */ |
||
18 | protected $property; |
||
19 | |||
20 | /** @var string */ |
||
21 | protected $columnName; |
||
22 | |||
23 | /** @var Collection */ |
||
24 | protected $ignored; |
||
25 | |||
26 | /** @var */ |
||
27 | protected $default; |
||
28 | |||
29 | public function __construct(string $property, $filterClass, ?string $columnName = null) |
||
39 | |||
40 | public function filter(Builder $builder, $value) |
||
56 | |||
57 | public static function exact(string $property, ?string $columnName = null) : self |
||
61 | |||
62 | public static function partial(string $property, $columnName = null) : self |
||
66 | |||
67 | public static function scope(string $property, $columnName = null) : self |
||
71 | |||
72 | public static function custom(string $property, $filterClass, $columnName = null) : self |
||
76 | |||
77 | public function getProperty(): string |
||
81 | |||
82 | public function isForProperty(string $property): bool |
||
86 | |||
87 | public function ignore(...$values): self |
||
95 | |||
96 | public function getIgnored(): array |
||
100 | |||
101 | public function default($value): self |
||
107 | |||
108 | public function getDefault() |
||
112 | |||
113 | public function isDefaultSet(): bool |
||
114 | { |
||
115 | return isset($this->default); |
||
116 | } |
||
117 | |||
118 | public function getColumnName(): string |
||
122 | |||
123 | private function resolveFilterClass(): CustomFilter |
||
131 | |||
132 | private function resolveValueForFiltering($property) |
||
142 | } |
||
143 |