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->title(trans('$testpackage::$car.names')) ->view('$testpackage::public.car.index') ->data(compact('$cars')) ->output(); } /** * Show car's list based on a type. * * @param string $slug * * @return response */ protected function list($type = null) { $cars = $this->repository ->pushCriteria(app('Litepie\Repository\Criteria\RequestCriteria')) ->scopeQuery(function($query){ return $query->orderBy('id','DESC'); })->paginate(); return $this->response->title(trans('$testpackage::$car.names')) ->view('$testpackage::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->title($$car->name . trans('$testpackage::$car.name')) ->view('$testpackage::public.car.show') ->data(compact('$car')) ->output(); } }