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