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