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