Summer Sale! All accounts are 50% off this week.

Ligonsker's avatar

Global Middleware VS Group that wraps all the routes

Currently I noticed all the routes are wrapped with a few middleware. My first thought was to move it to the global Middleware array in Kernel.php

And then I was curious: Is there any performance difference if you wrap around all your routes group:

// web.php

Route::group(['middleware' =>['auth', 'some_other_middleware']]), function () {
   // all the routes
}
0 likes
2 replies
Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

Routes are cached in production anyways so I doubt there is any performance difference at all

1 like

Please or to participate in this conversation.