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/SBogers110/franciscaansebeweging.nl/app/Komma/Travels/TravelController.php
<?php

namespace Komma\Travels;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redirect;
use Komma\BaseController;
use Komma\Pages\PageService;

class TravelController extends \BaseController
{
    protected $pageService;
    protected $travelService;

    public function __construct(PageService $pageService, TravelService $travelService)
    {
        parent::__construct();

        $this->pageService = $pageService;
        $this->travelService = $travelService;
    }

    public function show($id = 2)
    {
        //Check if language matches the url before loading the content
        //$this->languageService->checkRouteWithSetLanguage();
        //get content of page
        $travel = $this->travelService->getTravel($id);

        $page = $this->pageService->getPageContent($travel->travel_type, false);
        $page->parent = $this->pageService->getRootParent($page);

        //get all page links
        $links = $this->pageService->getAllRoutes();

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

    public function successSubscribe(){

        // Check if travel id is set in session
        if(\Session::get('travelId', null ) != null){

            // Get page info
            $travel = $this->travelService->getTravel(\Session::get('travelId'));
            $page = $this->pageService->getPageContent($travel->travel_type);
            \Session::forget('travelId');

        }
        else{

            // Else use the home
            $page = $this->pageService->getPageByCodeName('home');

        }

        $thanks = [
            'title' => \KommaLang::get('subscribeThanksTitle'),
            'description' =>  \KommaLang::get('subscribeThanksDescription'),
        ];

        //get all page links
        $links = $this->pageService->getAllRoutes();

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

    }

}