| Conditions | 1 |
| Paths | 1 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 1 |
| 1 | <?php |
||
| 25 | public function getCustomFilters(array $filters): LengthAwarePaginator |
||
| 26 | { |
||
| 27 | $query = Post::query()->withCount(['comments', 'likes'])->with(['comments', 'likes']); |
||
| 28 | |||
| 29 | $query = QueryPost::setBaseCustomFilterQuery($query, $filters); |
||
| 30 | |||
| 31 | $data = $query |
||
| 32 | ->wherePublished() |
||
| 33 | ->orderBy( |
||
| 34 | Arr::get($filters, 'order_by', 'updated_at'), |
||
| 35 | Arr::get($filters, 'order', 'desc') |
||
| 36 | ); |
||
| 37 | |||
| 38 | return $data->paginate((int) $filters['per_page']); |
||
| 39 | } |
||
| 41 |