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/kemi.komma.pro/app/KommaApp/Machines/MachineController.php
<?php

namespace App\KommaApp\Machines;

use App\Http\Controllers\Controller;
use App\KommaApp\Machines\Models\Machine;

class MachineController extends Controller
{
    private $pagePrefix = 'pages.machines.';
    private $machineService;

    public function __construct(MachineService $machineService)
    {
        parent::__construct();
        $this->machineService = $machineService;
    }

    /**
     * @return \Illuminate\Contracts\View\View
     */
    public function index()
    {
        $page = $this->pageService->getPageByCodeName('machines');
        $otherLanguageRoutes = $this->languageService->getOtherLanguagesRoutes($page);

        $machines = $this->machineService->getAllMachines(true);

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

    /**
     * @return \Illuminate\Contracts\View\View
     */
    public function filters()
    {
        $filters = request('filters');
        var_dump('Filter machines with these filters:');
        dd($filters);

        $page = $this->pageService->getPageByCodeName('machines');
        $otherLanguageRoutes = $this->languageService->getOtherLanguagesRoutes($page);

        $machines = $this->machineService->getAllMachines(true);


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


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

        $page = $this->pageService->getPageByCodeName('machines');
        $otherLanguageRoutes = $this->languageService->getOtherLanguagesRoutes($page, $machine);

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

}