Initialize from list of attributes.
@param Attribute[] $attributes
@return Attributes
491708
public static function init(array $attributes) {
        $obj = new Attributes;
        foreach ($attributes as $attribute) {
            $obj->{$attribute->key} = $attribute;
        }
        return $obj;
    }
537209
public function attr(Array $attributes) : Table
    {
        foreach( $attributes as $att => $val )
        {
            $this->attr[$att] = $val;
        }

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

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

        return $result;
    }
850696
public function setAttributes($attributes)
    {
        $attributes = self::prepareAttributes($attributes);
        $watched    = array();
        foreach ($this->watchedAttributes as $watchedKey) {
            if (isset($attributes[$watchedKey])) {
                $this->setAttribute($watchedKey, $attributes[$watchedKey]);
                unset($attributes[$watchedKey]);
            } else {
                $this->removeAttribute($watchedKey);
            }
            if (isset($this->attributes[$watchedKey])) {
                $watched[$watchedKey] = $this->attributes[$watchedKey];
            }
        }
        $this->attributes = array_merge($watched, $attributes);
        return $this;
    }
660025
protected function replaceAttributes(array $attributes)
    {
        foreach ($this->abbreviations as $abbreviation => $attribute) {
            if (isset($attributes[$abbreviation])) {
                $attributes[$attribute] = $attributes[$abbreviation];
                unset($attributes[$abbreviation]);
            }
        }

        return $attributes;
    }
514680
protected function buildAttributes($attributes)
    {
        if ( ! $attributes) {
            return;
        }

        $attributeMap = [];
        foreach ($attributes as $attribute => $value) {
            $attributeMap[] = $attribute . '="' . $value . '"';
        }

        return implode($attributeMap, ' ');
    }
867163
public function setAttributes($attributes)
    {
        if (isset($attributes['class'])) {
            $class = $attributes['class'];
            $this->setClass([$class]);
            unset($attributes['class']);
        }
        $this->attributes = $attributes;
        return $this;
    }
1092179
public function attributes($attributes)
    {
        if (is_array($this->attributes) and is_array($attributes)) {
            $attributes = array_merge($this->attributes, $attributes);
        }
        $this->attributes = $attributes;

        return $this;
    }
1359944
public function iniCasts(Collection $attributes)
    {
        $this->casts = $attributes->mapWithKeys(function ($attribute) {
            return [$attribute->getName() => $attribute];
        })->map(function ($attribute) {
            if ($attribute instanceof Attributes\ObjectAttribute) {
                return 'object';
            }

            if ($attribute instanceof Attributes\ArrayAttribute) {
                return 'array';
            }

            if ($attribute instanceof Attributes\BooleanAttribute) {
                return 'boolean';
            }

            if ($attribute instanceof Attributes\DateTimeAttribute) {
                return 'datetime';
            }

            if ($attribute instanceof Attributes\NumberAttribute) {
                return 'float';
            }

            if ($attribute instanceof Attributes\TextAttribute) {
                return 'string';
            }

            return null;
        })->filter(function ($item) {
            return $item !== null;
        })->toArray();
    }
195186
public function create(array $attributes)
    {
        $instance = $this->related->newInstance($attributes);

        $this->setForeignAttributesForCreate($instance);

        $instance->save();

        return $instance;
    }
1244940
public function fill(array $attributes) {
        $locales = Locale\get_locales();

        foreach($locales as $locale => $options)
            if( in_array($locale, array_keys($attributes)) )
                $this->translations[$locale] = array_pull($attributes, $locale);

        return parent::fill($attributes);
    }
542741
public function setAttributes($attributes) {
		if (is_array($attributes) && empty($attributes)) {
			$this->attributes = new \stdClass;
		} else {
			$this->attributes = $attributes;
		}

		return $this;
	}
247458
protected function prepareAttributes(array $attributes)
    {
        $attributes['data-sitekey'] = $this->sitekey;
        if (!isset($attributes['class'])) {
            $attributes['class'] = '';
        }
        $attributes['class'] = trim('g-recaptcha ' . $attributes['class']);

        return $attributes;
    }
1147987
public static function fromArray(array $attributes) {
		unset($attributes['id']);
		
		$attributesObject = new self();
		
		foreach ($attributes as $key => $value) {
			$attributesObject->add($key, $value);
		}
		
		return $attributesObject;
	}
963698
protected static function prepareAttributes($attributes)
    {
        $prepared = array();
        if (is_string($attributes)) {
            return self::parseAttributes($attributes);

        } elseif (is_array($attributes)) {
            foreach ($attributes as $key => $value) {
                if (is_int($key)) {
                    $key = strtolower($value);
                    $prepared[$key] = $key;
                } else {
                    $prepared[strtolower($key)] = (string)$value;
                }
            }
        }
        return $prepared;
    }
402767
public function create($attributes)
    {
        $attributes = $this->castRequest($attributes);
        $instance   = $this->model->newInstance($attributes);

        event(implode('-', $this->tag).'.entity.creating', [$this, $instance, $attributes]);

        $created = $instance->save();

        event(implode('-', $this->tag).'.entity.created', [$this, $instance, $attributes]);

        return [
            $created,
            $instance,
        ];
    }
1009243
public function create(array $attributes)
	{
		$group = $this->createModel();
		$group->fill($attributes);
		$group->save();
		return $group;
	}