There are methods for checking this:
Request::routeIs('your route name')
If you don't have that:
Request::route()->named('your route name')
Both of these would accept a route name, a string pattern or an array of strings being route names or patterns.
Laravel 8.x Docs - Requests - Inspecting the Request Path / Route routeIs
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…