/** * Returns a new LDAP Entry instance. * * @param array $attributes * * @return Entry */ public function newLdapEntry(array $attributes = []) { $attribute = $this->schema->objectCategory(); if (array_key_exists($attribute, $attributes) && array_key_exists(0, $attributes[$attribute])) { // We'll explode the DN so we can grab it's object category. $category = Utilities::explodeDn($attributes[$attribute][0]); // Make sure the category string exists in the attribute array. if (array_key_exists(0, $category)) { $category = strtolower($category[0]); $mappings = $this->map(); // Retrieve the category model mapping. if (array_key_exists($category, $mappings)) { $model = $mappings[$category]; return $this->newModel([], $model)->setRawAttributes($attributes); } } } // A default entry model if the object category isn't found. return $this->newModel()->setRawAttributes($attributes); }
/** * Returns a query builder limited to exchange servers. * * @return Builder */ public function computers() { return $this->query->whereEquals($this->schema->objectCategory(), $this->schema->objectCategoryComputer()); }
/** * Returns a query builder limited to users. * * @return Builder */ public function users() { return $this->query->whereEquals($this->schema->objectClass(), $this->schema->objectClassPerson())->whereEquals($this->schema->objectCategory(), $this->schema->objectCategoryPerson()); }