Skip to content

Commit

Permalink
Blade @Inject
Browse files Browse the repository at this point in the history
  • Loading branch information
sdebacker committed Jun 4, 2015
1 parent 1f4aa9e commit 2011a73
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/Providers/ModuleProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,22 @@ public function register()
return new CacheDecorator($repository, $laravelCache);
});

/**
* Calendar service
*/
$app->bind('TypiCMS\Modules\Events\Services\Calendar', function () {
return new Calendar(
new EluceoCalendar('TypiCMS'),
new EluceoEvent
);
});

/**
* Return the page linked to this module (for @inject in views)
*/
$app->singleton('typicms.events.page', function (Application $app) {
return TypiCMS::getPageLinkedToModule('events');
});

}
}
2 changes: 1 addition & 1 deletion src/resources/views/public/index.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@extends('pages::public.master')
<?php $page = TypiCMS::getPageLinkedToModule('events') ?>
@inject('page', 'typicms.events.page')

@section('bodyClass', 'body-events body-events-index body-page body-page-' . $page->id)

Expand Down
2 changes: 1 addition & 1 deletion src/resources/views/public/show.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@extends('core::public.master')
<?php $page = TypiCMS::getPageLinkedToModule('events') ?>
@inject('page', 'typicms.events.page')

@section('title', $model->title . '' . trans('news::global.name') . '' . $websiteTitle)
@section('ogTitle', $model->title)
Expand Down

0 comments on commit 2011a73

Please sign in to comment.