getDNAttrValues('',['namingcontexts']); return $result ? collect($result->namingcontexts) : NULL; } } /** * Search for a DN and return its attributes * * @param $dn * @param array $attrs * @param int $deref // @todo * @return Entry|bool */ protected function getDNAttrValues(string $dn,array $attrs=['*','+'],int $deref=LDAP_DEREF_NEVER): ?Entry { try { return ($x=(new Adldap) ->addProvider(config('ldap.connections.default.settings')) ->search() ->select($attrs) ->findByDn($dn)) ? $x : NULL; // @todo Tidy up this exception } catch (\Exception $e) { dd(['e'=>$e]); } } /** * Fetch a DN from the server * * @param $dn * @return |null */ public function fetch(string $dn,array $attributes=['*']) { try { return ($x=(new Adldap) ->addProvider(config('ldap.connections.default.settings')) ->search() ->select($attributes) ->findByDn($dn)) ? $x : NULL; // @todo Tidy up this exception } catch (\Exception $e) { dd(['e'=>$e]); } } /** * Query the server for a DN * * @param string $dn * @return |null */ public function query(string $dn) { try { return ($x=(new Adldap) ->addProvider(config('ldap.connections.default.settings')) ->search() ->setBaseDn($dn) //->select($attrs) ->listing() ->get()) ? $x : NULL; // @todo Tidy up this exception } catch (\Exception $e) { dd(['e'=>$e]); } } }