Exemplo n.º 1
0
 public function showPost($slug, Request $request)
 {
     $post = Post::with('tags')->whereSlug($slug)->firstOrFail();
     $tag = $request->get('tag');
     if ($tag) {
         $tag = Tag::whereTag($tag)->firstOrFail();
     }
     return view($post->layout, compact('post', 'tag'));
 }
Exemplo n.º 2
0
 public function showPost($slug, Request $request, ShortenLink $shortenLink)
 {
     $post = Post::with('tags')->whereSlug($slug)->firstOrFail();
     $tag = $request->get('tag');
     $link = $shortenLink->shortenUrl($request->url());
     $shortLink = $link->getShortUrl();
     if ($tag) {
         $tag = Tag::whereTag($tag)->firstOrFail();
     }
     return view($post->layout, compact('post', 'tag', 'slug', 'shortLink'));
 }