HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/ridderstee.komma.pro/app/Komma/Houses/HouseController.php
<?php

/**
 * Short description for the file.
 *
 * @author      Komma <support@komma.pro>
 * @copyright   (c) 2012-2015, Komma Mediadesign
 */

namespace Komma\Houses;

use Komma\Blocks\BlockService;
use Komma\LanguageService;
use Komma\Pages\PageService;

class HouseController extends \BaseController
{

    protected $pageService;
    protected $blockService;
    protected $houseService;
    public $languageService;

    public function __construct(PageService $pageService, BlockService $blockService, HouseService $houseService, LanguageService $languageService)
    {
        parent::__construct();
        $this->pageService = $pageService;
        $this->blockService = $blockService;
        $this->houseService = $houseService;
        $this->languageService = $languageService;
    }

    //House 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('houses');
        $links = $this->pageService->getAllRoutes();

        //Get all houses
        $houses = $this->houseService->getAllHouses();

        return \View::make('layouts.pages.houses.index')
            ->with('page', $page)
            ->with('links', $links)
            ->with('houses', $houses);

    }

    public function show($houseId){
        //Check if language matches the url before loading content
        $this->languageService->checkRouteWithSetLanguage();

        // Load the overview page, because its nice to have here
        $page = $this->pageService->getPageByCodeName('houses');

        $house = $this->houseService->getHouse($houseId);

        $links = $this->pageService->getAllRoutes();

        //Get all houses
        $houses = $this->houseService->getAllHouses();

        $this->houseService->getRelativeHouses($house, $houses);

        $page->translation->meta_title = $house->translation->name . ' | '. $page->translation->meta_title;
        $page->translation->meta_description = $house->translation->meta_description;


        return \View::make('layouts.pages.houses.show')
            ->with('page', $page)
            ->with('house', $house)
            ->with('links', $links)
            ->with('houses', $houses);
    }

}