Reputation: 113
I Want to skip the middleware for a particular route in a route group. How can I do this?
Route::group(['prefix' => 'testgroup','middleware' => ['login.oauth']],function (){
Route :: get('/', 'testController@index');
Route :: get('/api','testController@apiCall');
});
I want to skip the 'login.oauth' middleware for the Route :: get('/api','testController@apiCall')
Upvotes: 3
Views: 519
Reputation: 369
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');
});
Upvotes: 2
Reputation: 1150
Just create a second group without the middleware:
Route::group(['prefix' => 'testgroup','middleware' => ['login.oauth']],function (){
Route :: get('/', 'testController@index');
});
Route::group(['prefix' => 'testgroup'],function (){
Route :: get('/api','testController@apiCall');
});
Upvotes: 1