repository = $casestudy; parent::__construct(); } /** * Show casestudy's list. * * @param string $slug * * @return response */ protected function index() { $casestudies = $this->repository ->pushCriteria(app('Litepie\Repository\Criteria\RequestCriteria')) ->scopeQuery(function($query){ return $query->orderBy('id','DESC'); })->paginate(); return $this->response->title(trans('$casestudy::$casestudy.names')) ->view('$casestudy::public.casestudy.index') ->data(compact('$casestudies')) ->output(); } /** * Show casestudy's list based on a type. * * @param string $slug * * @return response */ protected function list($type = null) { $casestudies = $this->repository ->pushCriteria(app('Litepie\Repository\Criteria\RequestCriteria')) ->scopeQuery(function($query){ return $query->orderBy('id','DESC'); })->paginate(); return $this->response->title(trans('$casestudy::$casestudy.names')) ->view('$casestudy::public.casestudy.index') ->data(compact('$casestudies')) ->output(); } /** * Show casestudy. * * @param string $slug * * @return response */ protected function show($slug) { $casestudy = $this->repository->scopeQuery(function($query) use ($slug) { return $query->orderBy('id','DESC') ->where('slug', $slug); })->first(['*']); return $this->response->title($$casestudy->name . trans('$casestudy::$casestudy.name')) ->view('$casestudy::public.casestudy.show') ->data(compact('$casestudy')) ->output(); } }