Total Complexity | 11 |
Total Lines | 62 |
Duplicated Lines | 0 % |
Coverage | 92% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | trait WithFilters |
||
8 | { |
||
9 | protected $filters; |
||
10 | |||
11 | 15 | public function enableFilters($filters) |
|
18 | } |
||
19 | |||
20 | /** |
||
21 | * 自定义过滤器逻辑. |
||
22 | * |
||
23 | * @param \Zing\QueryBuilder\Filter[]|mixed $filters |
||
24 | * |
||
25 | * @return $this |
||
26 | * |
||
27 | * @deprecated use enableFilters instead |
||
28 | */ |
||
29 | public function addFilters($filters): self |
||
30 | { |
||
31 | return $this->enableFilters(is_array($filters) ? $filters : func_get_args()); |
||
32 | } |
||
33 | |||
34 | 15 | protected function formatFilters($filters) |
|
35 | { |
||
36 | return collect($filters)->map(function ($filter) { |
||
37 | 15 | if ($filter instanceof Filter) { |
|
38 | 14 | return $filter; |
|
39 | } |
||
40 | |||
41 | 1 | return Filter::exact($filter); |
|
42 | 15 | }); |
|
43 | } |
||
44 | |||
45 | 15 | protected function applyFilters() |
|
57 | } |
||
58 | 15 | }); |
|
59 | 15 | } |
|
60 | |||
61 | 15 | protected function isRequestedFilter(Filter $filter) |
|
64 | } |
||
65 | |||
66 | 14 | protected function getFilterValue(Filter $filter) |
|
71 |