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/rentman.komma.pro/app/Komma/Pages/PageController.php
<?php

namespace Komma\Pages;

use Komma\BaseController;
use Komma\Blocks\BlockService;
use Komma\Contact\ContactController;
use Komma\Images\ImageService;
use Komma\LanguageService;
use Komma\Sitemap\SitemapController;

class PageController extends \BaseController
{

    public $data;
    protected $pageService;
    protected $blockService;
    protected $contactController;
    protected $imageService;
    protected $sitemapController;
    public $languageService;

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

        $this->pageService = $pageService;
        $this->blockService = $blockService;
        $this->contactController = $contactController;
        $this->imageService = $imageService;
        $this->sitemapController = $sitemapController;
        $this->languageService = $languageService;
        $this->data = (object)[];
    }

    public function show($id = 2)
    {
        $this->data->id = $id;
        $this->languageService->checkRouteWithSetLanguage();
        $page = $this->pageService->getPageContent($id);
        $this->data->content = $page;
        $this->data->links = $this->pageService->getAllRoutes();
        if($this->data->content->active == 0) \App::abort(404, 'Page not found');
        if ($page->code_name == 'home') return $this->index($page);
        if ($page->code_name == 'pricing') return $this->index($page);
        if ($page->code_name == 'about') return $this->index($page);
        if ($page->code_name == 'customers') return $this->index($page);
        if ($page->code_name == 'data_security') return $this->index($page);
        if ($page->code_name == 'sitemap') return $this->sitemapController->showSitemap();
        if ($page->code_name == 'contact') return $this->contactController->contactForm();

        $page->blocks = $page->blocks->keyBy('code_name');
        $view = 'page';
        $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;
        $page->blocks = $this->blockService->getBlocksWhere('type', $page->code_name);
        $page->blocks = $page->blocks->keyBy('code_name');
        $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)
            ->with('otherLanguages', $otherLanguages->allTranslations);


    }

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