modules = $this->modules(config('newgenpower.category.modules'), 'category', guard_url('category')); $this->repository = $category; } /** * Show category's list. * * @return response */ protected function index(PublicRequest $request) { $search = $request->search; $pageLimit = $request->input('pageLimit', config('database.pagination.limit')); $data = $this->repository ->pushFilter(RequestFilter::class) ->pushFilter(CategoryPublicFilter::class) ->setPresenter(CategoryListPresenter::class) ->select('categories.*') ->paginate($pageLimit) ->withQueryString() ->toArray(); extract($data); $categories = []; $tags = []; $recent = []; return $this->response->setMetaTitle(trans('category::category.names')) ->view('category::public.category.index') ->data(compact('data', 'meta', 'categories', 'tags', 'recent')) ->output(); } /** * Show category. * * @param string $slug * * @return response */ protected function show(PublicRequest $request, $slug) { $data = $this->repository ->findBySlug($slug) ->toArray(); $categories = []; $tags = []; $recent = []; return $this->response->setMetaTitle($data['title'] . trans('category::category.name')) ->view('category::public.category.show') ->data(compact('data', 'categories', 'tags', 'recent')) ->output(); } }