-
Notifications
You must be signed in to change notification settings - Fork 10.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[10.x] Alternative to the stringy middleware API #46219
Conversation
Why shouldn't we have the option to pass in any type? |
I guess due to route serialization, when caching routes. |
The root reason, IMO, it that it would be a breaking change for user-land and 3rd party middleware. Middleware expect only strings, and may be typed as such. As much as I would like to investigate allowing rich type serialization / deserialization, it fundamentally changes middleware and feels like a major version change. |
Keeping it real - I honestly find your package better. This feels like just trades the loose string approach for a loose array approach. Would prefer adding context specific builders to the applicable middleware, with real methods and arguments: ->middleware([Authenticate::using('web')]); Basically would rather go through our existing built-in middleware and add those types of methods where it makes sense. |
I appreciate realness being kept. |
This is simplified and framework first implementation of my HasParameters package.
Removes the need to use string concatenation when specifying middleware. No need for middleware classes to extend a base class or use a trait. The framework just handles things.
Using a middleware class
Using a middleware alias
Optional single value API
You may omit the array if it is a single value.
Handles backed enums
Remember that all values are still cast to a string. The middleware does not receive the enum.