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/PDeckers/opelkapitan.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;
use Komma\Projects\ProjectController;

class PageController extends \BaseController
{

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

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

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

    public function show($id = 2)
    {
        $this->data->id = $id;
        $page = $this->pageService->getPageContent($id);
        $this->data->content = $page;

        if ($page->code_name == 'home') return $this->index($page);
        if ($page->code_name == 'about') return $this->index($page);
        if ($page->code_name == 'contact') return $this->contactController->contactForm();
        if ($page->code_name == 'other_3'){
            return $this->projectController->otherParts($page);
        }
        if (in_array($page->code_name, ['other_1','other_2'])){
            return $this->projectController->group($page, true);
        }
        if (in_array($page->code_name, ['kapitan_53_55','kapitan_56_57','kapitan_58_59', 'kapitan_60_64'])){
            return $this->projectController->group($page);
        }
        if ($page->code_name == 'other') return $this->projectController->otherOverview($page);

        $view = 'page';
        $this->data->links = $this->pageService->getAllRoutes();
        $otherLanguages = $this->pageService->getOtherLanguageRoutes($this->data->id);
        return \View::make('layouts.pages.' .$view)
            ->with('blocks', $page->blocks)
            ->with('data', $this->data)
            ->with('otherLanguages', $otherLanguages->allTranslations);
    }

    public function index($page = null)
    {

        if (!$page) $page = $this->pageService->getPageByCodeName('home');
        $otherLanguages = $this->pageService->getOtherLanguageRoutes($this->data->id);
        $this->data->content = $page;
        $this->data->id = $this->data->content->id;
        $this->data->links = $this->pageService->getAllRoutes();


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


    }

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