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