public function handle($request, Closure $next)
{
$segments = array_reverse(request()->segments());
if (($segments[1] ?? '') !== 'login') {
return $next($request);
}
if (!$this->canLoginAs()) {
throw new Exception("You can't log in as a specific user right now");
}
return $this->loginAsAndRedirect($segments[0]);
}