File: D:/HostingSpaces/SBogers85/dale-int.com/app/Komma/Pages/PageController.php
<?php
namespace Komma\Pages;
use Illuminate\Http\Request;
use Komma\BaseController;
use Komma\Blocks\BlockService;
use Komma\Contact\ContactController;
class PageController extends \BaseController
{
public $data;
protected $pageService;
protected $blockService;
protected $contactController;
public function __construct(PageService $pageService, BlockService $blockService, ContactController $contactController)
{
parent::__construct();
$this->pageService = $pageService;
$this->blockService = $blockService;
$this->contactController = $contactController;
$this->data = (object)[];
}
public function show($id = 2)
{
$this->data->id = $id;
$page = $this->pageService->getPageContent($id);
if ($page->code_name == 'contact') return $this->contactController->contactForm();
$this->data->content = $page;
$this->data->links = $this->pageService->getAllRoutes();
$blocks = $this->blockService->getAllBlocks();
$view = $this->data->content->code_name;
$otherLanguages = $this->pageService->getOtherLanguageRoutes($this->data->id);
return \View::make('layouts.pages.' .$view)
->with('blocks', $blocks)
->with('data', $this->data)
->with('otherLanguages', $otherLanguages->allTranslations);
}
}