middleware('web'); $this->setupTheme(config('theme.themes.public.theme'), config('theme.themes.public.layout')); $this->repository = $user; parent::__construct(); } /** * Show user's list. * * @param string $slug * * @return response */ protected function index() { $users = $this->repository ->pushCriteria(new \Sample\User\Repositories\Criteria\UserPublicCriteria()) ->scopeQuery(function($query){ return $query->orderBy('id','DESC'); })->paginate(); return $this->theme->of('user::public.user.index', compact('users'))->render(); } /** * Show user. * * @param string $slug * * @return response */ protected function show($slug) { $user = $this->repository->scopeQuery(function($query) use ($slug) { return $query->orderBy('id','DESC') ->where('slug', $slug); })->first(['*']); return $this->theme->of('user::public.user.show', compact('user'))->render(); } }