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