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/SBogers33/broosensterck.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\Kms\Schools\School;
use Komma\LanguageService;
use Komma\Pages\PageService;

class PostController extends \BaseController
{

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

    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($page = null){

        //get content of page by route because of the multiple news overviews all page links
        $page = $this->pageService->getPageByCodeName('references');
        $links = $this->pageService->getAllRoutes();

        $posts = $this->postService->getAllPosts(true, 6);
        $this->postService->makeCarbonDate($posts);

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

    public function show($postId){

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

        $page = $this->pageService->getPageByCodeName('references');
        $links = $this->pageService->getAllRoutes();

        $posts = $this->postService->getLatestPosts(7); 

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

    }

}