File: D:/HostingSpaces/SBogers110/franciscaansebeweging.nl/app/Komma/Vacancies/VacancyController.php
<?php
/**
* Short description for the file.
*
* @author Komma <support@komma.pro>
* @copyright (c) 2012-2015, Komma Mediadesign
*/
namespace Komma\Vacancies;
use Illuminate\Support\Facades\App;
use Komma\Blocks\BlockService;
use Komma\Pages\PageService;
class VacancyController extends \BaseController
{
protected $pageService;
protected $blockService;
protected $vacancyService;
public function __construct(PageService $pageService, BlockService $blockService, VacancyService $vacancyService)
{
parent::__construct();
$this->pageService = $pageService;
$this->blockService = $blockService;
$this->vacancyService = $vacancyService;
}
//Overview page
public function index($page = null){
if($page == null){
$page = $this->pageService->getPageByCodeName('vacancies');
}
$vacancies = $this->vacancyService->getAllVacancies();
$links = $this->pageService->getAllRoutes();
return \View::make('layouts.pages.vacancies.index')
->with('page', $page)
->with('vacancies', $vacancies)
->with('links', $links);
}
public function show($vacancyId){
$page = $this->pageService->getPageByCodeName('vacancies');
//Load vacancy content and translation of this vacancy
$vacancy = $this->vacancyService->getVacancy($vacancyId);
$links = $this->pageService->getAllRoutes();
// $vacancy->date = Carbon::createFromFormat('Y-m-d H:i:s', $vacancy->date);
return \View::make('layouts.pages.vacancies.show')
->with('page', $page)
->with('vacancy', $vacancy)
->with('links', $links);
}
}