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/Jobs/JobController.php
<?php

namespace App\Komma\Jobs;

use App\Http\Controllers\Controller;
use App\Komma\Components\ComponentService;
use App\Komma\Jobs\Models\Job;

class JobController extends Controller
{
    private $jobService;

    const AMOUNT_EACH_REQUEST = 5;

    public function __construct()
    {
        parent::__construct();
        $this->jobService = \App::make(JobService::class);
    }

    /**
     * @return \Illuminate\Contracts\View\View
     */
    public function index()
    {
        // Get the page through the set links
        $page = $this->links->jobs->node;

        $jobs = $this->jobService->getJobs();

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

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

    /**
     * @param Job $job
     * @return \Illuminate\Contracts\View\View
     */
    public function show(Job $job)
    {
        // Load the needed relations
        $job->load('translation', 'translations', 'site');

        $this->checkIfModelShouldThrowAbort($job);

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

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

        $otherJobs = $this->jobService->getNextJobs($job);

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

        // Return view
        return \View::make('site.templates.jobs_show', [
            'page' => $page,
            'job' => $job,
            'otherModels' => $otherJobs,
            'components' => $components,
            'links' => $this->links,
            'languageMenu' => $languageMenu,
        ]);
    }
}