File: D:/HostingSpaces/BVerhoeven/verhoevendak.nl/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 Komma\Blocks\BlockService;
use Komma\Categories\CategoryService;
use Komma\Pages\PageService;
class JobController extends \BaseController
{
protected $pageService;
protected $blockService;
protected $jobService;
protected $categoryService;
public function __construct(
PageService $pageService,
BlockService $blockService,
JobService $jobService,
CategoryService $categoryService
) {
parent::__construct();
$this->pageService = $pageService;
$this->blockService = $blockService;
$this->jobService = $jobService;
$this->categoryService = $categoryService;
}
//Job index page
public function index()
{
//get content of page and get all page links
$page = $this->pageService->getPageByCodeName('jobs');
$links = $this->pageService->getAllRoutes();
$jobs = $this->jobService->getAllJobs(false);
// dd($jobs);
return \View::make('layouts.pages.jobs.index')
->with('page', $page)
->with('links', $links)
->with('jobs', $jobs);
}
public function show($jobId)
{
//Check if language matches the url before loading content
$page = $this->jobService->getJob($jobId);
$page->parent = $this->pageService->getPageByCodeName('jobs');
$links = $this->pageService->getAllRoutes();
$homeBlock = $this->pageService->getPageByCodeName('home')->content->translation->description;
return \View::make('layouts.pages.jobs.show')
->with('page', $page)
->with('links', $links)
->with('homeBlock', $homeBlock);
}
}