Returns a new LDAP Entry instance.

@param array $attributes

@return Entry
171734
public function newLdapEntry(array $attributes = [])
    {
        $objectClass = $this->schema->objectClass();

        if (array_key_exists($objectClass, $attributes) && array_key_exists(0, $attributes[$objectClass])) {
            // Retrieve all of the object classes from the LDAP
            // entry and lowercase them for comparisons.
            $classes = array_map('strtolower', $attributes[$objectClass]);

            // Retrieve the model mapping.
            $models = $this->schema->objectClassModelMap();

            // Retrieve the object class mappings (with strtolower keys).
            $mappings = array_map('strtolower', array_keys($models));

            // Retrieve the model from the map using the entry's object class.
            $map = array_intersect($mappings, $classes);

            if (count($map) > 0) {
                // Retrieve the model using the object class.
                $model = $models[current($map)];

                // Construct and return a new model.
                return $this->newModel([], $model)
                    ->setRawAttributes($attributes);
            }
        }

        // A default entry model if the object class isn't found.
        return $this->newModel()->setRawAttributes($attributes);
    }
413315
public static function create(array $attributes = [])
    {
        $site_id = site()->id;

        $contact = new static;

        $fillable = $contact->getFillable();

        foreach (array_only($attributes, $fillable) as $key => $value) {

            if  (is_array($value)) {
                $value = json_encode($value);
            }
            $row = Setting::privateOnly()->firstOrNew(compact('key', 'site_id'));
            $row->fill(compact('value'));
            $row->save();
        }

        return true;
    }
372964
public function container(array $attributes = [])
    {
        $model = $this->schema->containerModel();

        return (new $model($attributes, $this->query))
            ->setAttribute($this->schema->objectClass(), $this->schema->objectClassContainer());
    }
623679
protected function createAndFill(array $attributes)
    {
        $entityClass = static::makes();
        $entity = new $entityClass;

        foreach($attributes as $attribute => $value) {
            $entity->$attribute = $value;
        }

        return $entity;
    }
1206762
public function newInstance($attributes = [], $exists = false)
    {
        $model = new static((array) $attributes, $this->parent, $this->table, $exists);
        $model->setPivotKeys($this->getForeignKey(), $this->getRelatedKey());
        return $model;
    }
1223840
public static function create(array $attributes)
    {
        $instance = new static;

        $path = $instance->getPath('store');

        return $instance->newQuery()
            ->postField($attributes)
            ->from($path)
            ->create();
    }
394908
public static function fromArray(array $attributes) {
        $object = new ArrayObject();
        foreach ($attributes as $key => $val) {
            $object[$key] = $val;
        }
        return $object;
    }
497279
public function user(array $attributes = [])
    {
        $model = $this->schema->userModel();

        return (new $model($attributes, $this->query))
            ->setAttribute($this->schema->objectClass(), $this->schema->userObjectClasses());
    }
279184
public function fromLdap(array $entry, array $selectedAttributes)
    {
        $this->selectedAttributes = $this->getSelectedAttributes($selectedAttributes, $entry);

        $newEntry = [];
        foreach ($entry as $attribute => $value) {
            if ($this->schema) {
                $newEntry = $this->setMappedNames($newEntry, $attribute, $value);
            }
            // If the LDAP attribute name was also explicitly selected for, and is not already in the array, add it...
            if ($this->selectedButNotPartOfEntry($attribute, $newEntry)) {
                $newEntry[self::arraySearchGetValue($attribute, $this->selectedAttributes)] = $value;
            }
        }
        // The DN attribute must be present as it is used in many critical functions.
        $newEntry = $this->addDnFromLdapIfNotPresent($newEntry, $entry);

        return $newEntry;
    }
549564
public function contact(array $attributes = [])
    {
        $model = $this->schema->contactModel();

        return (new $model($attributes, $this->query))
            ->setAttribute($this->schema->objectClass(), [
                $this->schema->top(),
                $this->schema->person(),
                $this->schema->organizationalPerson(),
                $this->schema->contact(),
            ]);
    }
93266
public function new(array $attributes = [], bool $exists = false): Model{
        return $this->model->newInstance($attributes, $exists);
    }
105236
public function create(array $attributes)
    {
        $group = new Group($attributes);

        $group->validateRequired();

        // Reset the container by reversing the current container
        $group->setAttribute('container', array_reverse($group->getAttribute('container')));

        $add['cn'] = $group->getAttribute('group_name');
        $add['samaccountname'] = $group->getAttribute('group_name');
        $add['objectClass'] = 'Group';
        $add['description'] = $group->getAttribute('description');

        $container = 'OU='.implode(',OU=', $group->getAttribute('container'));

        $dn = 'CN='.$add['cn'].', '.$container.','.$this->adldap->getBaseDn();

        return $this->connection->add($dn, $add);
    }
952796
public function toArray(array $attributes = array())
	{
		$data = parent::toArray();

		if(count($attributes) == 0)
			return $data;

		$new = array();

		foreach($attributes as $attribute)
			$new[$attribute] = $data[$attribute];

		return $new;
	}
580382
public static function create(array $attributes = [])
    {
        $user = new static($attributes);

        $user->setPassword($attributes['password']);

        $user->save();

        return $user;
    }
547103
public static function createOne(array $attributes)
    {
        return tap(new self($attributes), function (self $post) use ($attributes) {
            $post->save();

            $post->tags()->sync($attributes['tags']);

            $post->createSeo(
                static::extractSeoAttributes($attributes)
            );
        });
    }
329796
public function create($attributes = array())
    {
        $entity = $this->build($attributes);

        // to SQL.
        $criteria = $this->criteria();
        $sql = $criteria->toInsertSQL($attributes);

        // query.
        $sth = $this->query($sql, $criteria->getParams(), Database::TARGET_MASTER);
        if ($sth->isSuccess()) {
            $entity->exists = true;
            $entity->setPrimaryValue($sth->lastInsertId());
            return $entity;
        }
    }
621878
public static function factory($attributes)
    {
        $instance = new self();
        $values = array_values($attributes);
        $instance->_initialize(array_shift($values));
        return $instance;
    }