Route Middleware resource

Just want to know if theres an easier way to do this before I create a separate page for account information. I have a middleware on my user resource:
protected static string | array $routeMiddleware = [
GlobalTwoFactorAuth::class,
];
protected static string | array $routeMiddleware = [
GlobalTwoFactorAuth::class,
];
However, I want a user to be able to edit their own account regardless of this middleware.
4 Replies
toeknee
toeknee5mo ago
Can't you add an exception into the middleware class? i.e. if route X and user = user return true
Jamie Cee
Jamie Cee5mo ago
Potentially. Would have to override the middleware, as its coming from a package
toeknee
toeknee5mo ago
Ahh so just extend it, condition calling the parent?
Jamie Cee
Jamie Cee5mo ago
Yeah, Ill give that a go shortly (got a few other things I need to do first). Cheers 🙂