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/rentman2019.komma.pro/app/Komma/Solutions/SolutionController.php
<?php

namespace App\Komma\Solutions;

use App\Http\Controllers\Controller;
use App\Komma\Components\ComponentService;
use App\Komma\Solutions\Models\Solution;

class SolutionController extends Controller
{
    /**
     * @return mixed
     */
    public function index()
    {
        if (! isset($this->links->solutions)) {
            abort(404);
        }

        // Get the page through the set links
        $page = $this->links->solutions->node;

        // Get all products
        $solutions = $this->solutionService->getAllSolutions();

        // Make language menu for index page
        $languageMenu = $this->pageService->makeLanguageSwitchForPage($this->links->solutions, $this->links->home);

        // Return view
        return \View::make('site.templates.solutions_index', [
            'page' => $page,
            'links' => $this->links,
            'solutions' => $solutions,
            'languageMenu' => $languageMenu,
        ]);
    }

    /**
     * @param Solution $solution
     * @return \Illuminate\Contracts\View\View
     */
    public function show(Solution $solution)
    {
        if (! isset($this->links->solutions)) {
            abort(404);
        }
        $solution->load('translation', 'translations');

        $enTranslation = $solution->translations->where('language_id', 40)->first();

        if (! $enTranslation->active && $enTranslation->preview === 0) {
            abort(404);
        }

        if (! $solution->translation->preview) {
            $solution->setRelation('translation', $enTranslation);
        }

//        $this->checkIfModelShouldThrowAbort($solution);

        $page = $this->links->solutions->node;

        $componentService = \App::make(ComponentService::class);
        $components = $componentService->getViewComponents($solution->translation);

        // Make language menu for show page
        $languageMenu = $this->pageService->makeLanguageSwitchForPage($this->links->solutions);
        $this->pageService->extendLanguageMenuWithResource($languageMenu, $solution, $this->links->home);

        // Return view
        return \View::make('site.templates.solutions_show', [
            'page' => $page,
            'solution' => $solution,
            'components' => $components,
            'links' => $this->links,
            'languageMenu' => $languageMenu,
            'images' => $solution->languageImages(),
            'alterHeadings' => true,
        ]);
    }
}