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