Skip to content

Commit 5235250

Browse files
committed
Blade @Inject
1 parent ad2c47c commit 5235250

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

src/Providers/ModuleProvider.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,12 @@ public function register()
7373
return new CacheDecorator($repository, $laravelCache);
7474
});
7575

76+
/**
77+
* Return the page linked to this module (for @inject in views)
78+
*/
79+
$app->singleton('typicms.places.page', function (Application $app) {
80+
return TypiCMS::getPageLinkedToModule('places');
81+
});
82+
7683
}
7784
}

src/resources/views/public/index.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@extends('pages::public.master')
2-
<?php $page = TypiCMS::getPageLinkedToModule('places') ?>
2+
@inject('page', 'typicms.places.page')
33

44
@section('bodyClass', 'body-places body-places-index body-page body-page-' . $page->id)
55

src/resources/views/public/show.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@extends('core::public.master')
2-
<?php $page = TypiCMS::getPageLinkedToModule('places') ?>
2+
@inject('page', 'typicms.places.page')
33

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

0 commit comments

Comments
 (0)