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/Gideons/GideonController.php
<?php

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

namespace Komma\Gideons;

use Carbon\Carbon;
use Komma\Blocks\BlockService;
use Komma\Categories\Models\Category;
use Komma\LanguageService;
use Komma\Pages\PageService;

class GideonController extends \BaseController
{

    public $data;
    protected $pageService;
    protected $blockService;
    protected $gideonService;

    public function __construct(PageService $pageService, BlockService $blockService, GideonService $gideonService)
    {
        parent::__construct();
        $this->pageService = $pageService;
        $this->blockService = $blockService;
        $this->gideonService = $gideonService;
    }

    //Overview page
    public function index($page = null){

        if($page == null){
            $page = $this->pageService->getPageByCodeName('gideons');
        }

        $gideons = $this->gideonService->getAllGideons();
        $gideons = $this->gideonService->convertForSorting($gideons);

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

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

    public function show($gideonId){
        $page = $this->pageService->getPageByCodeName('gideons');

        //Load gideon content and translation of this gideon
        $gideon = $this->gideonService->getGideon($gideonId);
        $links = $this->pageService->getAllRoutes();

//        $gideon->date = Carbon::createFromFormat('Y-m-d H:i:s', $gideon->date);

        $gideon->dates = $gideon->getGideonDates();

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

}