我在构造函数中有一个包含以下内容的控制器:
$this->middleware('guest', ['except' =>
[
'logout',
'auth/facebook',
'auth/facebook/callback',
'auth/facebook/unlink'
]
]);
The 'logout' rule (which is there by default) works perfectly but the other 3 rules I have added are ignored. The routes in routes.php
look like this:
Route::group(['middleware' => ['web']],function(){
Route::auth();
// Facebook auth
Route::get('/auth/facebook', 'Auth\AuthController@redirectToFacebook')->name('facebook_auth');
Route::get('/auth/facebook/callback', 'Auth\AuthController@handleFacebookCallback')->name('facebook_callback');
Route::get('/auth/facebook/unlink', 'Auth\AuthController@handleFacebookUnlink')->name('facebook_unlink');
}
If I visit auth/facebook
, auth/facebook/callback
or auth/facebook/unlink
whilst logged in I get denied by the middleware and thrown back to the homepage.
我已经try 使用/
指定"例外"规则,以便它们与routes.php
中的路由完全匹配,但没有什么不同.你知道为什么这些规则被忽略了,而默认的"注销"规则却被尊重了吗?
干杯!