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,
]);
}
}