Path : /var/www/clients/client0/web25/web/app/Http/Controllers/ |
B-Con CMD Config cPanel C-Rdp D-Log Info Jump Mass Ransom Symlink vHost Zone-H |
Current File : /var/www/clients/client0/web25/web/app/Http/Controllers/PostController.php |
<?php namespace App\Http\Controllers; use App\Http\Middleware\Post; use App\Services\CategoryService; use App\Services\PostService; use App\Services\TagService; class PostController extends Controller { protected $postService; protected $categoryService; protected $tagService; public function __construct() { $this->postService = new PostService(); $this->categoryService = new CategoryService(); $this->tagService = new TagService(); } public function getPosts() { $posts = $this->postService->getPosts(null,config('app.nbrPages.posts')); return view('front.blog', compact('posts')); } public function getPostsByCategorySlug($slug) { $posts = $this->postService->getPostsByCategorySlug($slug); $message = $this->postService->getMessage($slug,null); return view('front.blog', compact(['posts','message'])); } public function getPost($slug) { $post = $this->postService->getPostBySlug($slug); $categories = $this->categoryService->getCategories(); $tags = $this->tagService->getTags(); $lastPosts = $this->postService->getLatestPosts(3); return view('front.blog-single', compact([ 'post', 'categories', 'tags', 'lastPosts', ])); } public function getPostsByTagSlug($slug) { $posts = $this->postService->getPostsByTagSlug($slug); $message = $this->postService->getMessage(null,$slug); return view('front.blog', compact(['posts','message'])); } public function searchPosts() { $posts = $this->postService->getPostsBySearch(); $title = $this->postService->getSearchTitle(); return view('front.blog', compact(['posts', 'title'])); } }