我在嘗試創建自定義過濾器時遇到了一些問題。我的目標是在允許他們訪問組內定義的路由之前,確保已通過身份驗證的用戶符合特定條件。自定義路由過濾器忽略重定向
現在它只是繼續/頁面沒有問題,即使我已經確認滿足這些條件之一。它忽略了我的重定向。
routes.php文件
Route::group(array('before' => 'registered'), function()
{
Route::get('/page', array('as' => 'page', 'uses' => '[email protected]'));
});
filters.php
Route::filter('registered', function()
{
if(Auth::check())
{
if(!Auth::user()->confirmed())
{
return Redirect::route('signup.send.confirmation')->with('alert-warning', 'You must confirm your email address before continuing. Fill out the form below if you need a new activation email. Thank you!');
}
if(!Auth::user()->registered)
{
return Redirect::route('signup.profile')->with('alert-warning', 'You must fill out the following information before continuing. Thank you!');
}
}
});
任何幫助,不勝感激!謝謝!