0

我想从“auth.sentry”过滤器中排除控制器中的某些方法。在 Laravel 4 中是否有更有效的方法来做到这一点。

Route::get('student/login','StudentController@getLogin');
Route::post('student/login','StudentController@postLogin');
Route::get('student/register','StudentController@getRegister');
Route::post('student/register','StudentController@postRegister');

Route::group(array('before'=>'auth.sentry'), function(){
    Route::controller('student','StudentController');
});
4

1 回答 1

0

你不能这样做。

但我认为更好地使用关注点分离单一责任原则将使您的路线对您有利:

Route::get('student/login','StudentLogonController@getLogin');
Route::post('student/login','StudentLogonController@postLogin');

Route::get('student/register','StudentRegisterController@getRegister');
Route::post('student/register','StudentRegisterController@postRegister');

Route::group(array('before'=>'auth.sentry'), function(){
    Route::controller('student','StudentController');
});

另外,看看 Phil Sturgeon 的“ Beware the Route to Evil ”,谈论路线。

于 2013-10-24T15:57:46.883 回答