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