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/SBogers93/fitale.nl/app/Komma/Pages/PageController.php
<?php

namespace Komma\Pages;

use Illuminate\Http\Request;
use Komma\BaseController;
use Komma\Blocks\BlockService;
use Komma\Contact\ContactController;

class PageController extends \BaseController
{

    public $data;
    protected $pageService;
    protected $blockService;
    protected $contactController;

    public function __construct(PageService $pageService, BlockService $blockService, ContactController $contactController)
    {
        $this->pageService = $pageService;
        $this->blockService = $blockService;
        $this->contactController = $contactController;

        $this->data = (object)[];
    }

    public function show($id = 2)
    {
        $this->data->id = $id;
        $page = $this->pageService->getPageContent($id);
        $this->data->content = $page;
        $this->data->links = $this->pageService->getUrl();
        //dd('hoi');

        if ($page->code_name == 'home') return $this->index($page);
        if ($page->code_name == 'contact') return $this->contactController->contactForm();


        $view = 'page';
        return \View::make('layouts.pages.' .$view)
            ->with('blocks', $page->blocks)
            ->with('data', $this->data);
    }

    public function index($page = null)
    {

        if (!$page) $page = $this->pageService->getPageByCodeName('home');

        $this->data->content = $page;
        $this->data->id = $this->data->content->id;
        $this->data->links = $this->pageService->getUrl();


        return \View::make('layouts.pages.' . $this->data->content->code_name)
            ->with('data', $this->data)
            ->with('blocks', $page->blocks);


    }

    public function contact(){
        dd('tet');
    }
}