Update the model in the database.

@param  array  $attributes
@return bool|int
495515
public function update(array $attributes = [])
    {
        if (isset($attributes['password'])) {
            $attributes['password'] = bcrypt($attributes['password']);
        }

        if (!parent::update($attributes)) {
            throw new Exception('Cannot update user.'); // @codeCoverageIgnore
        }
        if (!parent::update($attributes)) {
            throw new Exception('Cannot update user.'); // @codeCoverageIgnore
        }

        return $this->fresh();
    }
547875
public function addAttributes(array $attributes)
    {
        foreach ($attributes as $key => $value) {
            $this->addAttribute($key, $value);
        }
    }
1225678
public function copyForUpdateFrom( $model, $attributes = [] ) {

		foreach ( $attributes as $attribute ) {

			if( $this->hasAttribute( $attribute ) ) {

				$this->setAttribute( $attribute, $model->$attribute );
			}
			else {

				$this->$attribute = $model->$attribute;
			}
		}
	}
886452
public function save(array $attributes = [])
    {
        $this->fireModelEvent(new Events\Saving($this));

        $saved = $this->exists ? $this->update($attributes) : $this->create($attributes);

        if ($saved) {
            $this->fireModelEvent(new Events\Saved($this));
        }

        return $saved;
    }
653230
public function add(array $attributes = array())
    {
        if (!$this->contains($attributes)) {
            $this->model->getModel()->newInstance($attributes)->save();
            $this->cache->forget($this->cacheKey);
        }
        return $this;
    }
1152252
public function addAttributes(array $attributes)
	{
		foreach($attributes as $attrName => $attrValue) {
			$this->addAttribute($attrName, $attrValue);
		}
	}
692134
public function update($id, array $attributes = [])
    {
        // Find the given instance
        $updated  = false;
        $instance = $id instanceof Model ? $id : $this->find($id);

        if ($instance) {
            // Fill instance with data
            $instance->fill($attributes);

            // Save the instance
            $updated = $instance->save();

            // Fire the updated event
            $this->getContainer('events')->fire($this->getRepositoryId().'.entity.updated', [$this, $instance]);
        }

        return [
            $updated,
            $instance,
        ];
    }
1178685
public function update(array $attributes = [])
    {
        $this->fill($attributes);

        $modifications = $this->getModifications();

        if (count($modifications) > 0) {
            $this->fireModelEvent(new Events\Updating($this));

            // Push the update.
            if ($this->query->getConnection()->modifyBatch($this->getDn(), $modifications)) {
                // Re-sync attributes.
                $this->syncRaw();

                $this->fireModelEvent(new Events\Updated($this));

                // Re-set the models modifications.
                $this->modifications = [];

                return true;
            }

            // Modification failed, return false.
            return false;
        }

        // We need to return true here because modify batch will
        // return false if no modifications are made
        // but this may not always be the case.
        return true;
    }
983191
public function update(array $fields = [])
    {
        $connection = $this->getConnection();

        $this->beforeUpdateInternal();

        $connection->beginTransaction();
        try {
            if ($updated = $this->updateInternal($fields)) {
                $connection->commit();
            } else {
                $connection->rollBack();
            }
        } catch (Exception $e) {
            $connection->rollBack();
            throw $e;
        }

        $this->afterUpdateInternal();

        if ($updated) {
            $this->updateRelated();
            $this->attributes->resetOldAttributes();
        }

        return $updated;
    }
362409
public function toUpdateSQL($attributes = array())
    {
        $sql = [];
        $this->params = [];
        
        $sql[] = sprintf('UPDATE %s SET', $this->table->getTableName());
        $setts = [];
        foreach ($attributes as $key => $value) {
            $setts[] = sprintf('%s = ?', $key);
            $this->addParam($value);
        }
        $sql[] = join(', ', $setts);
        $sql[] = $this->where->toSQL();
        $this->bind($this->where->getParams());

        return join(' ', $sql);
    }
491708
public static function init(array $attributes) {
        $obj = new Attributes;
        foreach ($attributes as $attribute) {
            $obj->{$attribute->key} = $attribute;
        }
        return $obj;
    }
55678
public function store(array $attributes)
    {
        $model = $this->make([]);

        $this->validate($attributes, 'store');

        $this->fill($model, $attributes);

        $this->publish('storing', $model, $attributes);
        $this->save($model);
        $this->publish('stored', $model, $attributes);

        return $model;
    }
848274
public function withAttributes(array $attributes)
    {
        $clone = clone $this;

        foreach ($attributes as $name => $value) {
            $clone->dom->documentElement->setAttribute($name, $value);
        }

        return $clone;
    }
248163
public function update($id, array $attributes)
    {
        $model = $this->model->findOrFail($id);

        $this->validation()->validate('update', array_merge($attributes, [$this->model->getKeyName() => $id]));

        $model->fill($attributes);

        $model->save();

        return $model;
    }
1098071
public function updateExisting(array $attributes, array $options = []) : bool
    {
        if (!$this->exists) {
            return false;
        }

        return $this->forceFill($attributes)->save($options);
    }
701122
public function store(array $attributes)
    {
        $model = $this->make([]);

        $this->validate($attributes, 'store');

        $this->fillModel($model, $attributes);
        $this->fire($this->event('storing'), [$model, $attributes]);
        $model->save();
        $this->fire($this->event('stored'), [$model, $attributes]);
        return $model;
    }
143796
public function update(array $attributes = [], array $options = [])
    {
        if (! $this->exists) {
            return false;
        }

        return $this->fill($attributes)->save($options);
    }