我想从'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');
});
答案 0 :(得分:0)
你做不到这么多。
但我认为更好地利用Separation of Concerns和Single Resposibility Principle will可以让您的路线对您有利:
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”,谈论路线。