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

/**
 * Short description for the file.
 *
 * @author      Komma <support@komma.pro>
 * @copyright   (c) 2012-2015, Komma Mediadesign
 */

namespace Komma\Jobs;


use Illuminate\Http\Request;
use Komma\Pages\PageService;

class JobController extends \BaseController
{

    public $data;
    protected $jobService;
    protected $pageService;

    public function __construct(JobService $jobService, PageService $pageService)
    {
        parent::__construct();
        $this->jobService = $jobService;
        $this->pageService = $pageService;

        $this->data = (object)[];
    }

    //News index page
    public function index(){

        $page = $this->pageService->getPageByCodeName('jobs');

        $this->data->content = $page;
        $this->data->id = $this->data->content->id;
        $this->data->links = $this->pageService->getAllRoutes();
        $otherLanguages = $this->pageService->getOtherLanguageRoutes($this->data->id);

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

        return \View::make('layouts.pages.jobsOverview')
            ->with('data', $this->data)
            ->with('blocks', $page->blocks)
            ->with('otherLanguages', $otherLanguages->allTranslations)
            ->with('jobs', $jobs);

    }

    public function show($jobId){

//        if( \App::getLocale() !=  \Request::segment(1) ){
//            \App::setLocale(\Request::segment(1));
//            \Session::set('lang', \Request::segment(1));
//        }

        $this->setCurrentLanguageByRoute();

        $this->data = $this->jobService->getJob($jobId);
        $this->data->links = $this->pageService->getAllRoutes();

        if(isset($this->data->translation->description) && $this->data->translation->description != '[]') $this->data->translation->description = json_decode($this->data->translation->description);
        $this->data->content = (object)['code_name' => $this->data->code_name];

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

        $otherLanguages = $this->jobService->getOtherLanguageRoutes($jobId);

        $featurePage = $this->pageService->getPageByCodeName('jobs');
        if(isset($this->data->translation->name) && $featurePage->translation->meta_title) $this->data->meta_title = $this->data->translation->name.' | '.$featurePage->translation->meta_title;
        else $this->data->meta_title = '';

        if(isset($this->data->translation->meta_description) && $this->data->translation->meta_description != '')  $this->data->meta_description = strip_tags($this->data->translation->meta_description);
        else $this->data->meta_description = '';

        if(!isset($this->data->name ))

        return \View::make('layouts.pages.jobDetail')
            ->with('jobs', $jobs)
            ->with('otherLanguages', $otherLanguages)
            ->with('data', $this->data)->render();
    }

}