/**
* Performs the specified query on the current LDAP connection.
*
* @param string $query
*
* @return \Illuminate\Support\Collection|array
*/
public function query($query)
{
$dn = $this->getDn();
$selects = $this->getSelects();
if ($this->read) {
// If read is true, we'll perform a read search, retrieving one record
$results = $this->connection->read($dn, $query, $selects);
} elseif ($this->recursive) {
// If recursive is true, we'll perform a recursive search
$results = $this->connection->search($dn, $query, $selects);
} else {
// Read and recursive is false, we'll return a listing
$results = $this->connection->listing($dn, $query, $selects);
}
return $this->newProcessor()->process($results);
}