Fixed page category pagenation
This commit is contained in:
parent
5c4ae14dbc
commit
19f15b54a8
|
|
@ -31,12 +31,16 @@ class PageCategoryRepo
|
|||
|
||||
/**
|
||||
* @param array $filters
|
||||
* @return LengthAwarePaginator
|
||||
* @return mixed
|
||||
*/
|
||||
public static function getActiveList(array $filters = []): LengthAwarePaginator
|
||||
public static function getActiveList(array $filters = []): mixed
|
||||
{
|
||||
$filters['is_active'] = 1;
|
||||
$limit = (int) ($filters['limit'] ?? 0);
|
||||
$builder = self::getBuilder($filters);
|
||||
if ($limit > 0) {
|
||||
return $builder->limit($limit)->get();
|
||||
}
|
||||
|
||||
return $builder->paginate(perPage());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class PageCategoryController extends Controller
|
|||
|
||||
$data = [
|
||||
'category' => new PageCategoryDetail($pageCategory),
|
||||
'active_page_categories' => PageCategoryRepo::getActiveList(),
|
||||
'active_page_categories' => PageCategoryRepo::getActiveList(['limit' => 5]),
|
||||
'breadcrumb' => $breadCrumb,
|
||||
'category_pages' => $pageCategory->pages()->paginate(12),
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in New Issue