/** * Show listing of snippets filtered by a tag * GET /tags/{slug} */ public function getShow($slug) { $page = Input::get('page', 1); // Candidate for config item $perPage = 30; $pagiData = $this->snippet->byTag($slug, $page, $perPage); if (!$pagiData->tag) { return App::abort(404); } $tag = $pagiData->tag; $snippets = Paginator::make($pagiData->items, $pagiData->totalItems, $perPage); $tags = $this->tag->all(); $topSnippetContributors = $this->user->getTopSnippetContributors(); return View::make('tags.snippets', compact('snippets', 'tag', 'tags', 'topSnippetContributors')); }
/** * Show the snippet edit form * GET /members/snippets/{slug}/edit */ public function getEdit($slug) { $snippet = $this->snippet->bySlug($slug, $all = true); // validate that the user updating the snippet is the snippet author if (!$snippet->isTheAuthor(Auth::user())) { return App::abort(404); } $tags = $this->tag->all()->lists('name', 'id'); return View::make('member.snippets.edit', compact('snippet', 'tags')); }