File: D:/HostingSpaces/PDeckers/opelkapitan.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;
$this->data = (object)[];
}
//News index page
public function index(){
$page = $this->pageService->getPageByCodeName('news_overview');
$this->data->content = $page;
$this->data->id = $this->data->content->id;
$otherLanguages = $this->pageService->getOtherLanguageRoutes($this->data->id);
$posts = $this->postService->getAllPosts();
return \View::make('layouts.pages.postOverview')
->with('data', $this->data)
->with('blocks', $page->blocks)
->with('otherLanguages', $otherLanguages->allTranslations)
->with('posts', $posts);
}
public function show($postId){
$this->data = $this->postService->getPost($postId);
return \View::make('layouts.pages.postDetail')
->with('data', $this->data)->render();
}
}