Skip to content

Commit

Permalink
Middleware 'public' set in routes service provider
Browse files Browse the repository at this point in the history
  • Loading branch information
sdebacker committed Jan 9, 2018
1 parent c02ef31 commit dec6b9c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ public function map()
* Front office routes
*/
if ($page = TypiCMS::getPageLinkedToModule('partners')) {
$options = $page->private ? ['middleware' => 'auth'] : [];
foreach (locales() as $lang) {
if ($page->translate('status', $lang) && $uri = $page->uri($lang)) {
$router->get($uri, $options + ['uses' => 'PublicController@index'])->name($lang.'::index-partners');
$router->get($uri.'/{slug}', $options + ['uses' => 'PublicController@show'])->name($lang.'::partner');
$router->middleware('public')->group(function (Router $router) use ($page) {
$options = $page->private ? ['middleware' => 'auth'] : [];
foreach (locales() as $lang) {
if ($page->translate('status', $lang) && $uri = $page->uri($lang)) {
$router->get($uri, $options + ['uses' => 'PublicController@index'])->name($lang.'::index-partners');
$router->get($uri.'/{slug}', $options + ['uses' => 'PublicController@show'])->name($lang.'::partner');
}
}
}
});
}

/*
Expand Down

0 comments on commit dec6b9c

Please sign in to comment.