@param array $attributes

@throws \Doctrine\DBAL\DBALException
@throws \Mindy\QueryBuilder\Exception\NotSupportedException

@return string
962287
public function updateSql(array $attributes)
    {
        $attrs = [];
        foreach ($attributes as $key => $value) {
            $attrs[$this->getModel()->convertToPrimaryKeyName($key)] = $value;
        }

        $sql = $this
            ->getQueryBuilder()
            ->update()
            ->table($this->getModel()->tableName())
            ->values($attrs)
            ->toSQL();

        return $sql;
    }
1307690
protected function prepareAttributes(array $attributes)
    {
        foreach ($attributes as $key => $value) {
            if (is_numeric($key)) {
                unset($attributes[$key]);
                $attributes[$value] = true;
                continue;
            }
        }

        if (isset($attributes['null'])) {
            unset($attributes['null']);
            $attributes['notnull'] = false;
        }

        return $attributes;
    }
867560
protected function fillableFromArray(array $attributes)
    {
        if (count($this->fillable) > 0 && ! static::$unguarded) {
            return array_intersect_key($attributes, array_flip($this->fillable));
        }

        return $attributes;
    }
311218
protected function skipNullValue(array $attributes)
    {
        $attr = [];

        foreach ($attributes as $key => $value) {
            if (null !== $value) {
                $attr[$key] = \is_array($value)
                    ? $this->skipNullValue($value)
                    : $value;
            }
        }

        return $attr;
    }
647021
public function datagridAttributes(array $attributes)
    {
        $result = '';

        foreach ($attributes as $attributeName => $attributeValue) {
            $result .= ' '.$attributeName.'="'.$attributeValue.'"';
        }

        return $result;
    }
394908
public static function fromArray(array $attributes) {
        $object = new ArrayObject();
        foreach ($attributes as $key => $val) {
            $object[$key] = $val;
        }
        return $object;
    }
213987
public function formatAttributes(array $attributes) {
        foreach ($attributes as $key => $attr) {
            if ($attr instanceof Closure) {
                $attributes[$key] = call_user_func($attr, $this);

            } else if ($this->hasKeyword($attr)) {
                $attributes[$key] = $this->getKeyword($attr);

            } else if ($attr === true) {
                $attributes[$key] = $this->getKeyword($key);

            } else {
                $attributes[$key] = (string) $attr;
            }
        }

        return $attributes;
    }
767481
protected function createQuery(array $attributes = null): Query
    {
        return Query::insert()->into(static::$tableName)
            ->set($attributes ?? $this->getFieldsValues());
    }
478593
public function matchSingleResult(array $attributes) : array
    {
        $column = $this->relation;

        if (!$this->asArray) {
            throw new MappingException("column '$column' should be of type array or json");
        }

        return $this->matchAsArray($attributes);
    }
781140
public function update(array $attributes)
    {
        if ($this->related->usesTimestamps()) {
            $attributes[$this->relatedUpdatedAt()] = $this->related->freshTimestamp();
        }

        return $this->query->update($attributes);
    }
125083
public function getByAttributes(array $attributes) : ?Model
    {
        if (empty($attributes)) {
            return null;
        }

        // First we will add each credential element to the query as a where clause.
        // Then we can execute the query and, if we found a user, return it in a
        // Eloquent User "model" that will be utilized by the Guard instances.
        $query = $this->getModel()->newQuery();

        foreach ($attributes as $key => $value) {
            $query->where($key, $value);
        }

        return $query->first();
    }
1141073
public function insert($attributes)
    {
        $params = [];
        $setStr = "";

        foreach ($attributes as $key => $value) {
            if ($key != $this->getPrimaryKey()) {
                $setStr .= "`" . str_replace("`", "``",
                        $key) . "` = :" . $key . ",";
                $value = is_array($value) ? json_encode($value) : $value;
                $params[':' . $key] = $value;
            }
        }

        if ($this->timestamps && !is_null($this->timestampCreatedAt)) {
            $params[':' . $this->timestampCreatedAt] = date('Y-m-d H:i:s');
        }

        $paramStr = implode("`" . ',', array_keys($params));
        $colStr = str_replace(':', "`", $paramStr) . "`";
        $paramStr = str_replace("`", "", $paramStr);

        $sql = "INSERT INTO " . $this->getTable() .
            " (" . $colStr . ") VALUES (" . $paramStr . ")";

        try {
            $stmt = $this->db->prepare($sql);
            $this->setLastQuery($stmt->queryString, $params);
            $stmt->execute($params);
        } catch (\PDOException $e) {
            throw new DatabaseException($e->getMessage() . '<br>' . $this->getLastQuery()[0]);
        }

        $insertId = $this->getInsertId();

        return $insertId;
    }
533202
protected function attributesArrayToText($attributes)
    {
        $text = "";

        foreach ($attributes as $name => $value)
        {
            $text .= "{$name}=\"{$value}\" ";
        }

        $text = rtrim($text);

        return $text;
    }
523882
private function toElequent(array $attributes)
    {
        $obj = new static();
        $casts = $obj->casts;
        $obj->casts = [];
        $obj->setRawAttributes($attributes);
        $obj->casts = $casts;

        return $obj;
    }
990370
protected function parseAttributes(array $attributes)
    {
        $result = [];

        foreach ($attributes as $attribute => $value) {
            $result[$this->parseConstantValue($attribute)] = $value;
        }

        return $result;
    }
280413
private function getTagAttributes($attributes)
    {
        if (!$attributes) {
            return '';
        }

        $tagAttributes = '';

        foreach ($attributes as $key => $attribute) {
            $tagAttributes .= ' ' . $key . '="' . $attribute . '"';
        }

        return $tagAttributes;
    }
749145
public function getHtml(array $attributes = []): string
    {
        $result = '';
        foreach ($this->radioButtons as $radioButton) {
            $result .= $radioButton->getHtml($attributes) . htmlspecialchars($radioButton->getLabel());
        }

        return $result;
    }