repository = $words; parent::__construct(); } /** * Show words's list. * * @param string $slug * * @return response */ protected function index() { $words = $this->repository->scopeQuery(function($query){ return $query->orderBy('id','DESC'); })->paginate(); return $this->theme->of('words::public.words.index', compact('words'))->render(); } /** * Show words. * * @param string $slug * * @return response */ protected function show($slug) { $words = $this->repository->scopeQuery(function($query) use ($slug) { return $query->orderBy('id','DESC') ->where('slug', $slug); })->first(['*']); return $this->theme->of('words::public.words.show', compact('words'))->render(); } }