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/SBogers106/rvt-trainingen.nl/app/Komma/Pages/PageController.php
<?php

namespace Komma\Pages;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redirect;
use Komma\BaseController;
use Komma\Blocks\BlockService;
use Komma\Contact\ContactController;
use Komma\Sitemap\SitemapController;

class PageController extends \BaseController
{
    protected $pageService;
    protected $blockService;
    protected $contactController;
    protected $sitemapController;

    public function __construct(PageService $pageService, BlockService $blockService, ContactController $contactController, SitemapController $sitemapController)
    {
        parent::__construct();

        $this->pageService = $pageService;
        $this->blockService = $blockService;
        $this->contactController = $contactController;
        $this->sitemapController = $sitemapController;
    }

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

        //Check if needed to send to other location/controller
        if ($page->code_name == 'sitemap') return $this->sitemapController->showSitemap($page);
        if ($page->code_name == 'contact') return $this->contactController->contactForm($page);

        //get all page links
        $links = $this->pageService->getAllRoutes();

        if($page->code_name ==  'about') $page->slider = $this->blockService->getBlocksWhere('type', 'about-steps', false);
        if($page->code_name ==  'methods') $page->slider = $this->blockService->getBlocksWhere('type', 'method-steps', false);
        if($page->code_name ==  'lotuscircle') $page->slider = $this->blockService->getBlocksWhere('type', 'lotuscircle-steps', false);
        if($page->code_name ==  'mysteryActs') $page->slider = $this->blockService->getBlocksWhere('type', 'mystery-acts-steps', false);

        //View is code name unless there's a custom view
        $view = empty($page->view_name) ? $page->code_name : $page->view_name;

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