/**
  * @param string $slug
  * @return \Illuminate\View\View
  */
 public function getBlogFrontend($slug = '')
 {
     if ($slug == '') {
         $blog = Blog::first();
     }
     try {
         $blog = Blog::findBySlugOrIdOrFail($slug);
         $blog->increment('views');
     } catch (ModelNotFoundException $e) {
         return Response::view('404', array(), 404);
     }
     // Show the page
     return View('blogitem', compact('blog'));
 }
Exemple #2
0
 /**
  * @param string $slug
  * @return \Illuminate\View\View
  */
 public function getBlogFrontend($slug = '')
 {
     if ($slug == '') {
         $blog = Blog::first();
     }
     try {
         $blog = Blog::findBySlugOrIdOrFail($slug);
         $blog->increment('views');
     } catch (ModelNotFoundException $e) {
         return Response::view('404', array(), 404);
     }
     $popular = Blog::orderBy('views', 'DESC')->first();
     // Show the page
     return View('blog.show', compact('blog', 'popular'));
 }