F
Filament16mo ago
*

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:
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.
Jump to solution
3 Replies
Solution
*
*16mo ago
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.
Patrick Boivin
Patrick Boivin16mo ago
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.
*
*OP16mo ago
Since there are no other opinions or comments on this, marking it as resolved. Thanks for the input @pboivin
Want results from more Discord servers?
Add your server