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/Anvil/anvil-industries.com/app/KommaApp/Pages/PageController.php
<?php

namespace App\KommaApp\Pages;

use App\Http\Controllers\Controller;
use App\KommaApp\Pages\Models\Page;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Str;

class PageController extends Controller
{
    private $pagePrefix = 'pages.';

    /**
     * @param Page $page
     * @return \Illuminate\Contracts\View\View
     */
    public function show(Page $page)
    {
        // Load translation by eager loading
        $page->load('translation');

        // Check if given Page belongs to the set site
        if ($page->site_id != \App::getSite()->id) {
            abort(404);
        }

        $this->pageService->generateBreadcrumbTree($page, $this->links);

        // Get the route in other languages for menu and meta title
        $otherLanguageRoutes = $this->languageService->getOtherLanguagesRoutes($page);

        $page->translation = $this->decodeDynamicContent($page->translation);

        $view = $this->getPageView($page);

        // Return view
        return \View::make($view, [
            'page' => $page,
            'links' => $this->links,
            'otherLanguages' => $otherLanguageRoutes,
        ]);
    }

    public function getMachineParkAsPDF()
    {
        $html = view('pdf.machinepark')->render();

//        // Report all errors
//        error_reporting(E_ALL);
//        ini_set('display_errors', true);
//        ini_set("memory_limit", "4096M");
//        ini_set("max_execution_time", "99999");

        $pdf = \App::make('dompdf.wrapper');
        $pdf->loadHTML($html)->setWarnings(true)->setPaper('a4', 'landscape');
        return $pdf->download(Str::slug('Machinepark ' . config('site.'.\App::getSite()->slug.'.name')) . '.pdf');
    }

    /**
     * Get the view for the page
     *
     * @param Page $page
     * @return string
     */
    private function getPageView(Page $page)
    {

        // Set view for direct children of the group pages
        if ($page->depth == 3 && $page->breadcrumbTree[1]->node->node->code_name === 'group') {
            $view = $this->baseViewPath . $this->pagePrefix . 'company';

            // Determine the reference used on the page because we always want one
            $this->referenceService->determineReferenceAndShareWithViews($page, false);

            // If the view exists return it
            if (\View::exists($view)) {
                return $view;
            }
        }

        // Try if the page has it's own view (by code_name)
        $view = $this->baseViewPath . $this->pagePrefix . $page->code_name;

        if ($page->code_name == 'about') {
            $this->referenceService->determineReferenceAndShareWithViews($page, false);
        }

        // If the view exists return it
        if (\View::exists($view)) {
            return $view;
        } // Else return the default
        else {
            return $this->baseViewPath . $this->pagePrefix . 'default';
        }
    }

    public function signature()
    {
        $template = Input::get('template');
        if(!$template) return view('signature/form');

        return view('signature/template', Input::all());
    }

}