问题
How to use before filter in Laravel in a group?
Route::group(['before'=>'auth','domain' => 'm.domain.us'], function(){
...
Route::get('/','PageController@index');
});
I tried in this way, if I use only domain in group it works but I want to use auth filter
on all pages in this group because it is admin section and when I entered 'before' => 'admin'
and it gets an error:
This webpage has a redirect loop.
Where is the problem here?
回答1:
Probably this occurs because your Login-Route is inside your ::group-filter
.
This means: Program checks also on login page if user is logged in. Of course, the user is not -> Redirect::to('login')
... There you have your loop =)
来源:https://stackoverflow.com/questions/23147712/redirect-loop-in-laravel