File: D:/HostingSpaces/SBogers10/zuiderbos.komma.pro/Komma/Projects/ProjectController.php
<?php
/**
* Short description for the file.
*
* @author Komma <support@komma.pro>
* @copyright (c) 2012-2015, Komma Mediadesign
*/
namespace Komma\Projects;
use Komma\Blocks\BlockService;
use Komma\Images\ImageService;
use Komma\LanguageService;
use Komma\Pages\PageService;
class ProjectController extends \BaseController
{
protected $pageService;
protected $blockService;
protected $projectService;
public $languageService;
public function __construct(PageService $pageService, BlockService $blockService, ProjectService $projectService, LanguageService $languageService)
{
parent::__construct();
$this->pageService = $pageService;
$this->blockService = $blockService;
$this->projectService = $projectService;
$this->languageService = $languageService;
}
//Project index page
public function index(){
//Check if language matches the url before loading content
$this->languageService->checkRouteWithSetLanguage();
//get content of page and get all page links
$page = $this->pageService->getPageByCodeName('projects');
$links = $this->pageService->getAllRoutes();
//Get all projects
$projects = $this->projectService->getAllProjects();
return \View::make('layouts.pages.projectsOverview')
->with('page', $page)
->with('links', $links)
->with('projects', $projects);
}
public function show($projectId){
//Check if language matches the url before loading content
$this->languageService->checkRouteWithSetLanguage();
$page = $this->projectService->getProject($projectId);
$links = $this->pageService->getAllRoutes();
return \View::make('layouts.pages.projectDetail')
->with('page', $page)
->with('links', $links);
}
}