我想跳过路由组中特定路由的中间件。我怎么能这样做?
Route::group(['prefix' => 'testgroup','middleware' => ['login.oauth']],function (){
Route :: get('/', 'testController@index');
Route :: get('/api','testController@apiCall');
});
我想跳过' login.oauth' Route :: get('/api','testController@apiCall')
答案 0 :(得分:2)
Please keep that testgroup function must be accessible to all routes and middleware function to particular(some other route) in the same function
Route::group(['prefix' => 'testgroup'], function () {
Route::group(['middleware' => ['login.oauth'], function() {
Route :: get('/', 'testController@index');
});
Route :: get('/api','testController@apiCall');
});
答案 1 :(得分:1)
只需创建没有中间件的第二组:
Route::group(['prefix' => 'testgroup','middleware' => ['login.oauth']],function (){
Route :: get('/', 'testController@index');
});
Route::group(['prefix' => 'testgroup'],function (){
Route :: get('/api','testController@apiCall');
});