Adding flexibility when registering middleware #45166
Unanswered
another-universe
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Sometimes, when registering resource routes, we want to apply middleware only to individual routes, or vice versa, not to apply some middleware previously assigned to individual resource routes.
Currently, we can achieve this using the only() and except() methods. But in this case, you have to register resource routes in two steps.
My suggestion is that we can pass an associative array to the middleware() and withoutMiddleware() methods. In this case, the key is the name of the middleware, and the value is a string containing the name of the method, or an array of such strings.
It will be more clear to show this with an example.
Beta Was this translation helpful? Give feedback.
All reactions