/** * Show listing of snippets of a user * GET /profiles/{slug}/snippets */ public function getSnippets($slug) { $page = Input::get('page', 1); // Candidate for config item $perPage = 10; $pagiData = $this->snippet->byAuthor($slug, $page, $perPage); $user = $pagiData->user; $snippets = Paginator::make($pagiData->items, $pagiData->totalItems, $perPage); return View::make('users.snippets', compact('snippets', 'user')); }
/** * Show dashboard with snippets and starred snippets of the current logged-in user * GET /members/dashboard */ public function dashboard() { $page = Input::get('page', 1); // Candidate for config item $perPage = 10; $pagiData = $this->snippet->byAuthor(Auth::user()->slug, $page, $perPage, $all = true); $my_snippets = Paginator::make($pagiData->items, $pagiData->totalItems, $perPage); $user = Auth::user(); $starred_snippets = $user->starred()->with('Snippet')->get(); return View::make('member.users.dashboard', compact('my_snippets', 'starred_snippets')); }