| Conditions | 4 |
| Paths | 8 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 31 | public function getData(array $filters, string $orderBy, string $orderSort, int $page, int $perPage) |
||
| 32 | { |
||
| 33 | $query = clone $this->query; |
||
| 34 | |||
| 35 | foreach ($filters as $field => $value) { |
||
| 36 | $query->where($field, 'LIKE', '%' . $value . '%'); |
||
| 37 | } |
||
| 38 | |||
| 39 | if ($orderBy) { |
||
| 40 | $query->orderBy($orderBy, $orderSort); |
||
| 41 | } |
||
| 42 | |||
| 43 | if ($perPage == 0) { |
||
| 44 | return $query->get(); |
||
| 45 | } |
||
| 46 | |||
| 47 | return $query->offset(($page - 1) * $perPage)->limit($perPage)->get(); |
||
| 48 | } |
||
| 49 | } |