/**
  * Display the specified category.
  *
  * @param  int $id
  *
  * @return Response
  */
 public function show($id)
 {
     $category = Category::find($id);
     if (!$category) {
         abort(404);
     }
     $viewData = ['category' => $category, 'pageTitle' => 'Category: ' . $category->title];
     if (current_theme_exists() && theme_view_exists(current_theme(), 'categories.show')) {
         return response(current_theme_view('categories.show', $viewData));
     }
     return view('categories.show', $viewData);
 }
 public function getHome()
 {
     $recentPosts = Post::where('is_published', '=', true)->orderBy('published_at', 'desc')->take(4)->get();
     $featuredPost = $recentPosts->shift();
     $more = false;
     if (Post::where('is_published', '=', true)->count() > 5) {
         $more = true;
     }
     $viewData = ['pageTitle' => 'Home', 'featuredPost' => $featuredPost, 'recentPosts' => $recentPosts, 'more' => $more];
     if (current_theme_exists() && theme_view_exists(current_theme(), 'home')) {
         return response(current_theme_view('home', $viewData));
     }
     return view('home', $viewData);
 }
 public function getPageBySlug($slug)
 {
     $page = Page::where('slug', '=', $slug)->where('is_published', '=', true)->first();
     if (!$page) {
         abort(404);
     }
     $viewData = ['pageTitle' => $page->title, 'page' => $page];
     if (current_theme_exists() && theme_view_exists(current_theme(), 'pages.show')) {
         return response(current_theme_view('pages.show', $viewData));
     }
     return view('pages.show', $viewData);
 }