Conditions | 5 |
Paths | 5 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
30 | public function apply($query): Builder |
||
31 | { |
||
32 | foreach ($this->values as $key => $param_value) { |
||
33 | if (!in_array($key, self::$reserve_param['f_params'])) { |
||
34 | throw new EloquentFilterException("$key is not in f_params array.", 2); |
||
35 | } |
||
36 | if (is_array($param_value)) { |
||
37 | $this->values['orderBy']['field'] = explode(',', $this->values['orderBy']['field']); |
||
38 | foreach ($this->values['orderBy']['field'] as $order_by) { |
||
39 | $query->orderBy($order_by, $this->values['orderBy']['type']); |
||
40 | } |
||
41 | } else { |
||
42 | $query->limit($param_value); |
||
43 | } |
||
44 | } |
||
45 | |||
46 | return $query; |
||
47 | } |
||
49 |