/** * Unstars a snippet * GET /snippets/{slug}/unstar */ public function unstarSnippet($slug) { $snippet = $this->snippet->bySlug($slug); $user = Auth::user(); if (empty($user)) { return Redirect::route('snippet.getShow', array($slug))->with('message', sprintf('Only logged in users can unstar snippets. Please %s or %s.', link_to_route('auth.getLogin', 'login'), link_to_route('auth.getSignup', 'signup'))); } $user->unStarSnippet($snippet->id); return Redirect::route('snippet.getShow', array($slug)); }
/** * 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')); }