FilamentF
Filament3y 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.
Was this page helpful?