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