modules = $this->modules(config('litecms.blog.modules'), 'blog', guard_url('blog')); $this->repository = $blog; } /** * Show blog'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(BlogPublicFilter::class) ->setPresenter(BlogListPresenter::class) ->select('blogs.*') ->paginate($pageLimit) ->withQueryString() ->toArray(); extract($data); $categories = []; $tags = []; $recent = []; return $this->response->setMetaTitle(trans('blog::blog.names')) ->view('blog::public.blog.index') ->data(compact('data', 'meta', 'categories', 'tags', 'recent')) ->output(); } /** * Show blog. * * @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('blog::blog.name')) ->view('blog::public.blog.show') ->data(compact('data', 'categories', 'tags', 'recent')) ->output(); } }