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