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