File: D:/HostingSpaces/SBogers10/debierbaron.komma.pro/app/Komma/Blog/BlogController.php
<?php
/**
* Short description for the file.
*
* @author Tim Van Samang <timvansamang@komma.pro>
* @copyright (c) 2012-2015, Komma Mediadesign
*/
namespace Komma\Blog;
use Komma\Pages\PageService;
class BlogController extends \BaseController
{
private $blogService;
private $pageService;
public $data;
public function __construct(BlogService $blogService, PageService $pageService)
{
$this->data = new \StdClass();
$this->blogService = $blogService;
$this->pageService = $pageService;
}
public function index()
{
$this->data->content = $this->pageService->getPageByCodeName('blog');
if (!$blogItems = $this->blogService->getBlogItems()) dd('test');
$this->data->id = 3;
//$this->data->content = new \StdClass();
$this->data->content->items = $blogItems;
//dd($this->data->content->items);
return \View::make('layouts.blog.overview')->withData($this->data);
}
public function detail($blogId)
{
if (!$blog = $this->blogService->getBlog($blogId)) return \App::abort(404);
$this->data->id = $blogId;
$this->data->content = $blog;
return \View::make('layouts.blog.item')->withData($this->data);
}
}