File: D:/HostingSpaces/SBogers26/gripp.nu/app/Komma/Posts/PostController.php
<?php
/**
* Short description for the file.
*
* @author Tim Van Samang <timvansamang@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, PostService $postService)
{
$this->pageService = $pageService;
$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;
$posts = $this->postService->getAllPosts();
$this->data->meta_title = 'Nieuwsoverzicht | Gripp Energiebeheer';
$this->postService->makeCarbonDate($posts);
return \View::make('posts.overview')
->with('data', $this->data)
->with('blocks', $page->blocks)
->with('posts', $posts);
}
public function show($postId){
$this->data = $this->postService->getPost($postId);
$posts = $this->postService->getLatestPosts(6);
$this->postService->makeCarbonDate($posts);
$this->data->meta_title = $this->data->translation->title.' | Gripp Energiebeheer';
$this->data->meta_description = strip_tags($this->data->translation->meta_description);
return \View::make('posts.postDetail')
->with('data', $this->data)
->with('posts', $posts)
->render();
}
}