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