我有一个在构造以下控制器规则:Laravel中间件“除了”不工作
$this->middleware('guest', ['except' =>
[
'logout',
'auth/facebook',
'auth/facebook/callback',
'auth/facebook/unlink'
]
]);
的“注销”规则(这是有默认)的作品完美,但其他3条规则我有添加被忽略。在routes.php
的路线是这样的:
Route::group(['middleware' => ['web']],function(){
Route::auth();
// Facebook auth
Route::get('/auth/facebook', 'Auth\[email protected]')->name('facebook_auth');
Route::get('/auth/facebook/callback', 'Auth\[email protected]')->name('facebook_callback');
Route::get('/auth/facebook/unlink', 'Auth\[email protected]')->name('facebook_unlink');
}
如果我访问auth/facebook
,auth/facebook/callback
或auth/facebook/unlink
同时登录我得到中间件否认,扔回到主页。
我试着指定的'除外'规则,所以它们完全匹配routes.php
的路线,但没有区别。任何想法为什么这些规则被忽略,而默认的“注销”规则是受到尊重的?
干杯!