File: D:/HostingSpaces/SBogers110/franciscaansebeweging.nl/app/Komma/Activities/ActivityController.php
<?php
/**
* Short description for the file.
*
* @author Komma <support@komma.pro>
* @copyright (c) 2012-2015, Komma Mediadesign
*/
namespace Komma\Activities;
use Carbon\Carbon;
use Komma\Blocks\BlockService;
use Komma\Categories\Models\Category;
use Komma\LanguageService;
use Komma\Pages\PageService;
class ActivityController extends \BaseController
{
public $data;
protected $pageService;
protected $blockService;
protected $activityService;
public function __construct(PageService $pageService, BlockService $blockService, ActivityService $activityService)
{
parent::__construct();
$this->pageService = $pageService;
$this->blockService = $blockService;
$this->activityService = $activityService;
}
//Overview page
public function index($page = null){
if($page == null){
$page = $this->pageService->getPageByCodeName('activities');
}
$activities = $this->activityService->getAllActivities();
$activities = $this->activityService->convertForSorting($activities);
$links = $this->pageService->getAllRoutes();
return \View::make('layouts.pages.activities.index')
->with('page', $page)
->with('activities', $activities)
->with('links', $links);
}
public function show($activityId){
$page = $this->pageService->getPageByCodeName('activities');
//Load activity content and translation of this activity
$activity = $this->activityService->getActivity($activityId);
$links = $this->pageService->getAllRoutes();
// $activity->date = Carbon::createFromFormat('Y-m-d H:i:s', $activity->date);
$activity->dates = $activity->getActivityDates();
return \View::make('layouts.pages.activities.show')
->with('page', $page)
->with('activity', $activity)
->with('links', $links);
}
}