can we add multiple middleware on single route laravel code example

Example 1: laravel route multiple middleware

Route::get('/', function () {
//
})->middleware('first', 'second');

Example 2: laravel route multiple middleware

Route::group(['middleware' => ['auth', 'web']], function() {
  // uses 'auth' middleware plus all middleware from $middlewareGroups['web']
  Route::resource('blog','BlogController'); //Make a CRUD controller
});

Example 3: can we use two middleware in one page

Route::group(['middleware' => ['firstMiddleware','secondMiddleware']], function () {
    //
});

Tags:

Php Example