public function getAdminHome() { $totalPosts = Post::count(); $totalPages = Page::count(); $viewData = ['pageTitle' => 'Dashboard', 'totalPosts' => $totalPosts, 'totalPages' => $totalPages]; return view('admin::index', $viewData); }
public function getPostBySlug($slug) { $post = Post::where('slug', '=', $slug)->where('is_published', '=', true)->first(); if (!$post) { abort(404); } $viewData = ['post' => $post, 'pageTitle' => $post->title]; if (current_theme_exists() && theme_view_exists(current_theme(), 'posts.show')) { return response(current_theme_view('posts.show', $viewData)); } return view('posts.show', $viewData); }