$key]); } // We need to override our Connection object so that we can store and retrieve the logged in user and swap out the credentials to use them. $c = Container::getInstance() ->getConnection($key); $c->setConfiguration(config('ldap.connections.'.$key)); $c->setGuardResolver(fn()=>new Guard($c->getLdapConnection(),$c->getConfiguration())); return $next($request); } }