Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 跳过Laravel中路由组内特定路由的中间件_Php_Laravel_Laravel 5 - Fatal编程技术网

Php 跳过Laravel中路由组内特定路由的中间件

Php 跳过Laravel中路由组内特定路由的中间件,php,laravel,laravel-5,Php,Laravel,Laravel 5,我想跳过路由组中特定路由的中间件。我该怎么做 Route::group(['prefix' => 'testgroup','middleware' => ['login.oauth']],function (){ Route :: get('/', 'testController@index'); Route :: get('/api','testController@apiCall'); }); 我想跳过Route::get('/api',的'login.oau

我想跳过路由组中特定路由的中间件。我该怎么做

Route::group(['prefix' => 'testgroup','middleware' => ['login.oauth']],function (){
    Route :: get('/', 'testController@index');
    Route :: get('/api','testController@apiCall');
}); 

我想跳过
Route::get('/api',的'login.oauth'中间件testController@apiCall)

只需在不使用中间件的情况下创建第二个组:

Route::group(['prefix' => 'testgroup','middleware' => ['login.oauth']],function (){
    Route :: get('/', 'testController@index');
});

Route::group(['prefix' => 'testgroup'],function (){
    Route :: get('/api','testController@apiCall');
});

请注意,测试组功能必须可供同一功能中的所有路由和中间件功能访问(某些其他路由)

    Route::group(['prefix' => 'testgroup'], function () {
       Route::group(['middleware' => ['login.oauth'], function() {
        Route :: get('/', 'testController@index');
       });
       Route :: get('/api','testController@apiCall');
    });

将路由置于组外?两个路由组使用相同的前缀。允许这样做吗?允许这样做-laravel将遍历所有组/前缀以查找路由。我希望将此路由置于同一组中。因此,我不必更改此特定请求的URL前缀。Route::group(['prefix'=>'testgroup','middleware'=>['login.oauth'],function(){Route::get('/'),'testController@index“);});});我已经编辑了条件,您现在可以检查它,希望它会有帮助