Answer the question
In order to leave comments, you need to log in
How to get the route to which the redirect occurs in the middleware?
I tried to do it like this:
$response = $next($request);
$route = Route::getRoutes()->match($response->getTargetUrl());
var_dump($route->getName());
Answer the question
In order to leave comments, you need to log in
In one of the projects, it was necessary to get the route done like this
$backRoute = app('router')->getRoutes()->match(app('request')->create(redirect()->back()->getTargetUrl()));
$backRouteName = $backRoute->getName();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question