Skip to content

Commit 28511c4

Browse files
committed
Middleware 'public' set in routes service provider
1 parent 5e72e70 commit 28511c4

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/Providers/RouteServiceProvider.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@ public function map()
3131
* Front office routes
3232
*/
3333
if ($page = TypiCMS::getPageLinkedToModule('places')) {
34-
$options = $page->private ? ['middleware' => 'auth'] : [];
35-
foreach (locales() as $lang) {
36-
if ($page->translate('status', $lang) && $uri = $page->uri($lang)) {
37-
$router->get($uri, $options + ['uses' => 'PublicController@index'])->name($lang.'::index-places');
38-
$router->get($uri.'/{slug}', $options + ['uses' => 'PublicController@show'])->name($lang.'::place');
34+
$router->middleware('public')->group(function (Router $router) use ($page) {
35+
$options = $page->private ? ['middleware' => 'auth'] : [];
36+
foreach (locales() as $lang) {
37+
if ($page->translate('status', $lang) && $uri = $page->uri($lang)) {
38+
$router->get($uri, $options + ['uses' => 'PublicController@index'])->name($lang.'::index-places');
39+
$router->get($uri.'/{slug}', $options + ['uses' => 'PublicController@show'])->name($lang.'::place');
40+
}
3941
}
40-
}
42+
});
4143
}
4244

4345
/*

0 commit comments

Comments
 (0)