Create the given model and convert it to an array.

@param  array $customAttributes Custom attributes that will override the guessed formatters.
@return array
167513
public function raw($customAttributes = [])
    {
        // If the first argument is a string, we'll assume it's the class name
        // of a different model to create.
        if (is_string($customAttributes)) {
            return $this->populator->raw(...func_get_args());
        }

        // We need to make() the model first since closures attributes receive the model instance.
        return $this->make($customAttributes)->toArray();
    }
25209
public static function buildAttributes($attributes)
    {
        $options = array();
        foreach ($attributes as $attr => $val) {
            $options[] = "{$attr}=\"{$val}\"";
        }
        return implode(' ', $options);
    }
53910
public function attributesToArray()
    {
        $attributes = $this->getArrayableAttributes();

        foreach ($this->getDates() as $key) {
            if (! isset($attributes[$key])) {
                continue;
            }

            $attributes[$key] = (string) $this->asDateTime($attributes[$key]);
        }

        foreach ($this->getMutatedAttributes() as $key) {
            if (! array_key_exists($key, $attributes)) {
                continue;
            }

            $attributes[$key] = $this->mutateAttributeForArray($key, $attributes[$key]);
        }

        foreach ($this->getArrayableAppends() as $key) {
            $attributes[$key] = $this->mutateAttributeForArray($key, null);
        }

        return $attributes;
    }
57893
protected function applyDefaultAttrValues(array $attributes = [])
    {
        $attributes = parent::applyDefaultAttrValues($attributes);

        // Set defaults for the entire entity.
        foreach ($this->getMetadata()->defaultValues as $key => $value) {
            if (isset($attributes[$key])) {
                continue;
            }
            $attributes[$key] = $this->convertAttributeValue($key, $value);
        }
        return $attributes;
    }
758315
protected function prepareAttributes()
    {

        // initialize the values that has to be updated
        $updatedAt = date('Y-m-d H:i:s');
        $path = $this->getValue(ColumnKeys::PATH);

        // prepare and return the array with the updated values
        return array(
            MemberNames::PATH           => $path,
            MemberNames::UPDATED_AT     => $updatedAt
        );
    }
1091282
protected function buildAttributes(array $attributes)
    {
        $html = [];

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

        return count($html) ? ' '.implode(' ', $html) : '';
    }
841632
public static function attributes(array $attributes = array())
    {
        $formattedAttributes = array();

        foreach ($attributes as $name => $value) {
            if (is_null($value)) {
                continue;
            }
            $name = is_string($name) ? $name : $value;
            $formattedAttributes[$name] = $name . '="' . self::escape($value) . '"';
        }

        return $formattedAttributes ? ' ' . implode(' ', $formattedAttributes) : '';
    }
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;
    }
89519
protected static function serializeAttributes(array $attributes)
	{
		$xml = '';
		ksort($attributes);
		foreach ($attributes as $attrName => $attrValue)
		{
			$xml .= ' ' . htmlspecialchars($attrName, ENT_QUOTES) . '="' . htmlspecialchars($attrValue, ENT_COMPAT) . '"';
		}

		// Normalize control characters to what the parser would normally produce
		$xml = preg_replace('/\\r\\n?/', "\n", $xml);
		$xml = preg_replace('/[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F]+/S', '', $xml);
		$xml = str_replace("\n", '&#10;', $xml);

		return self::encodeUnicodeSupplementaryCharacters($xml);
	}
354091
protected function normalizeAttributes()
    {
        if ($this->attributes === null) {
            if ($this->model instanceof Model) {
                $this->attributes = $this->model->attributes();
            } elseif (is_object($this->model)) {
                $this->attributes = $this->model instanceof Arrayable ? $this->model->toArray() : array_keys(get_object_vars($this->model));
            } elseif (is_array($this->model)) {
                $this->attributes = array_keys($this->model);
            } else {
                throw new InvalidConfigException('The "model" property must be either an array or an object.');
            }
            sort($this->attributes);
        }

        foreach ($this->attributes as $i => $attribute) {
            if (is_string($attribute)) {
                if (!preg_match('/^([\w\.]+)(:(\w*))?(:(.*))?$/', $attribute, $matches)) {
                    throw new InvalidConfigException('The attribute must be specified in the format of "attribute", "attribute:format" or "attribute:format:label"');
                }
                $attribute = [
                    'attribute' => $matches[1],
                    'format' => isset($matches[3]) ? $matches[3] : 'text',
                    'label' => isset($matches[5]) ? $matches[5] : null,
                ];
            }

            if (!is_array($attribute)) {
                throw new InvalidConfigException('The attribute configuration must be an array.');
            }

            if (isset($attribute['visible']) && !$attribute['visible']) {
                unset($this->attributes[$i]);
                continue;
            }

            if (!isset($attribute['format'])) {
                $attribute['format'] = 'text';
            }
            if (isset($attribute['attribute'])) {
                $attributeName = $attribute['attribute'];
                if (!isset($attribute['label'])) {
                    $attribute['label'] = $this->model instanceof Model ? $this->model->getAttributeLabel($attributeName) : Inflector::camel2words($attributeName, true);
                }
                if (!array_key_exists('value', $attribute)) {
                    $attribute['value'] = ArrayHelper::getValue($this->model, $attributeName);
                }
            } elseif (!isset($attribute['label']) || !array_key_exists('value', $attribute)) {
                throw new InvalidConfigException('The attribute configuration requires the "attribute" element to determine the value and display label.');
            }

            $this->attributes[$i] = $attribute;
        }
    }
374274
public function attributesToArray()
    {
        $attributes = parent::attributesToArray();

        foreach ($attributes as $key => $value) {
            if ($this->valid($key, $value)) {
                $attributes[$key] = decrypt($value);
            }
        }

        return $attributes;
    }
446666
protected function _create(array $attributes)
    {
        $model = $this->newModelInstance()->forceFill($attributes);

        $model->save();

        return $model;
    }
585243
public function prepareAttributes()
    {
        $attrs = [];

        $this->prepare($attrs);

        $attrs = array_merge($attrs, (array) $this->getAttribute('attribs'));

        return $attrs;
    }
581801
protected function prepareAttributes($attributes)
    {
        foreach($this->getAttributeConfig() as $attr => $config){

            // If the attribute is not defined in model or $attributes array
            // set the default value.
            if(!isset($this->attributes[$attr]) && !isset($attributes[$attr])){

                $attributes[$attr] = $config['default'];

            }

        }

        foreach($attributes as $key => $value){

            if(isset($this->config['attributes'][$key])){

                $attributes[$key] = $this->$key()->before_save($value);

            } elseif(isset($this->config['relationships'][$key])){

                unset($attributes[$key]);

                $relationship = $this->config['relationships'][$key];

                $this->translateShorthand($value);

                switch($relationship['type']){

                    case Relationship::HAS_PIVOT:

                        if($value instanceof Collection) $value = $value->all();

                        if($value instanceof EntityContract) $value = [$value];

                        $this->$key()->saveMany($value);

                        break;

                    case Relationship::HAS_MANY:

                        $this->$key()->saveMany((array)$value);

                        break;

                    case Relationship::BELONGS_TO:

                        $this->$key()->associate($value);

                        break;

                    case Relationship::HAS_ONE:

                        $this->$key()->save($value);

                        break;

                    default:

                        throw new \Exception(sprintf(
                            "Unknown relationship type \"%s\" on entity \"%s\"",
                            $relationship['type'],
                            $relationship['entity']
                        ));

                        break;
                }

            }

        }

        return $attributes;
    }
461746
public function parameterize($attributes = [])
    {
        $parameters = (new Parameters($attributes))->toArray();

        $values = [];
        $replacements = [];

        foreach (array_dot($parameters) as $key => $value) {
            if ($this->isCallbackFunction($value, $key)) {
                $values[] = trim($value);
                array_set($parameters, $key, '%' . $key . '%');
                $replacements[] = '"%' . $key . '%"';
            }
        }

        $new = [];
        foreach ($parameters as $key => $value) {
            array_set($new, $key, $value);
        }

        $json = json_encode($new);

        $json = str_replace($replacements, $values, $json);

        return $json;
    }
934312
public function getAttributes()
    {

        // initialize the array with the attributes
        $attributes = array();

        // prepare the pattern to filter the attributes
        $pattern = sprintf('%s-*', $this->getSerial());

        // prepare the array with the attributes
        foreach ($this as $key => $value) {
            if (fnmatch($pattern, $key)) {
                $attributes[$key] = $value;
            }
        }

        // return the attributes
        return $attributes;
    }
1060008
public static function create($attributes = [])
    {
        try {
            self::init();
            foreach ($attributes as $column => $value) {
                $columns[] = $column;
                $values[] = ':'.$column;
            }

            $sql = 'INSERT INTO ' . self::$modelTable . ' (' . implode(',', $columns) . ') VALUES (' . implode(',', $values) . ')';
            $stm = self::$connect->prepare($sql);
            $stm->execute($attributes);
            return self::find(self::$connect->lastInsertId());
        } catch (\Exception $exception) {
            var_dump($exception->getMessage());
        }
    }