Laravel 4路由滤波器控制器Methor排除

时间:2013-10-24 15:44:56

标签: php laravel laravel-4 laravel-routing

我想从'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');
});

1 个答案:

答案 0 :(得分:0)

你做不到这么多。

但我认为更好地利用Separation of ConcernsSingle 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”,谈论路线。