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