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/SBogers10/debierbaron.komma.pro/data/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 = null;


//        $this->data->content = new \StdClass();
        $this->data->content->items = $blogItems;

        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);

    }

}