HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/jacques-hein/jacques-hein.nl/app/Komma/Posts/PostController.php
<?php

/**
 * Short description for the file.
 *
 * @author      Komma <support@komma.pro>
 * @copyright   (c) 2012-2015, Komma Mediadesign
 */

namespace Komma\Posts;

use Komma\Blocks\BlockService;
use Komma\Pages\PageService;

class PostController extends \BaseController
{

    public $data;
    protected $pageService;
    protected $blockService;
    protected $postService;

    public function __construct(PageService $pageService, BlockService $blockService, PostService $postService)
    {
        parent::__construct();
        $this->pageService = $pageService;
        $this->blockService = $blockService;
        $this->postService = $postService;
    }

    //Overview page
    public function index(){
        setlocale(LC_TIME, 'nld_nld');

        //get content of page and get all page links
        $page = $this->pageService->getPageByCodeName('news');
        $links = $this->pageService->getAllRoutes();

        //Get the blog items with pagination
        $posts = $this->postService->getAllPosts(true);
        $this->postService->makeCarbonDate($posts);

        return \View::make('layouts.pages.postOverview')
            ->with('page', $page)
            ->with('links', $links)
            ->with('posts', $posts);

    }

    public function show($postId){

        //Load post content and translation of this post
        $page = $this->postService->getPost($postId);
        $links = $this->pageService->getAllRoutes();

        return \View::make('layouts.pages.postDetail')
            ->with('page', $page)
            ->with('links', $links);
    }

}