What is the best way of applying custom middleware to the registration page?
I want to apply one of my own middleware classes to the registration page after adding in
->registration()
in a panel service provider.
Tried adding in the HasRoutes
concern in a registration page component which extends Filament\Pages\Auth\Register\
and implemented getRouteMiddleware()
and routes()
with no luck.Solution:Jump to solution
The only way I could get it to work is adding it in the middleware array for the whole panel, then checking the route in the middleware early and returning. Works, but not ideal, I really don't want it to run for any route for that panel.
3 Replies
Solution
The only way I could get it to work is adding it in the middleware array for the whole panel, then checking the route in the middleware early and returning. Works, but not ideal, I really don't want it to run for any route for that panel.
It's not a bad solution in my opinion, there are other middlewares in the system that do nothing if a condition is not met.
Since there are no other opinions or comments on this, marking it as resolved.
Thanks for the input @pboivin