Create a collection of models and persist them to the database.

@param  array  $attributes
@return mixed
513919
public function create(array $attributes = [])
    {
        $results = $this->make($attributes);

        $this->getMapper()->store($results);

        return $results;
    }
17776
public static function fromArray(array $attributes)
    {
        return new self(
            $attributes['id'],
            $attributes['name'],
            $attributes['price'],
            $attributes['quantity'],
            Arr::get($attributes, 'options', [])
        );
    }
1122365
public function firstOrCreate(array $attributes = [])
    {
        $model = $this->first();
        if (!$model) {
            $model = $this->create($attributes);
        }
        return $model;
    }
523882
private function toElequent(array $attributes)
    {
        $obj = new static();
        $casts = $obj->casts;
        $obj->casts = [];
        $obj->setRawAttributes($attributes);
        $obj->casts = $casts;

        return $obj;
    }
491708
public static function init(array $attributes) {
        $obj = new Attributes;
        foreach ($attributes as $attribute) {
            $obj->{$attribute->key} = $attribute;
        }
        return $obj;
    }
548253
public function make(array $attributes = [])
    {
        $instance = $this->related->newInstance($attributes);
        $this->setForeignAttributesForCreate($instance);
        return $instance;
    }
158384
public function make(array $attributes = [])
    {
        /** @var Identifiable $model */
        $model = $this->performMake($attributes);
        $this->fill($model, $attributes);
        $this->callAfterListeners('make', [$model]);

        return $model;
    }
1162461
protected function fillableFromArray(array $attributes)
    {
        if (! empty($attributes) && property_exists($this, 'defaults')) {
            $attributes = array_diff_assoc($attributes, $this->defaults);
        }

        return parent::fillableFromArray($attributes);
    }
497279
public function user(array $attributes = [])
    {
        $model = $this->schema->userModel();

        return (new $model($attributes, $this->query))
            ->setAttribute($this->schema->objectClass(), $this->schema->userObjectClasses());
    }
155968
public function create(array $attributes)
    {
        // Is this a bulk create?
        if (array_values($attributes) == $attributes) {
            $that = $this;
            $collection = new IlluminateCollection($attributes);
            return $collection->map(function($attrs) use ($that) { return $that->create($attrs); });
        }

        $model = $this->create_new($attributes);
        $model->save();

        // TODO: dry with 'queryEagerLoadRelations'
        $eagerLoads = $this->query->getEagerLoads();
        if (count($eagerLoads) > 0)
        {
            $relations = $this->query->eagerLoadRelations(array($model));
            $model = $relations[0];
        }

        return $model;
    }
1200513
public function create(array $attributes = [])
    {
        $results = $this->make($attributes);

        if ($results instanceof Model) {
            $this->store(collect([$results]));

            $this->callAfterCreating(collect([$results]));
        } else {
            $this->store($results);

            $this->callAfterCreating($results);
        }

        return $results;
    }
291901
public function store(array $attributes)
    {
        $model = $this->newInstance($attributes);
        if ($this->save($model)) {
            return $model;
        }

        throw new DataIntegrityException("Cannot store attributes");
    }
1331468
public function archive($attributes)
    {
        $arraybleAttributes = array_map(function($attributes) {
           return $this->getArrayble($attributes);
        }, func_get_args());

        $params = array_merge([function() {
            return new static(func_get_args());
        }, $this->attributes], $arraybleAttributes);

        return new static(call_user_func_array('array_map', $params));
    }
1318864
public function save($attributes = [])
    {
        $attributes = (empty($attributes) || is_null($attributes)) ? $this->getAttributes() : $attributes;

        return $this->_save($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;
	}
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;
	}
700110
public function create($attributes = [])
    {
        // Attributes have to be array
        if (!(isset($attributes)) || !is_array($attributes)) {
            throw new \InvalidArgumentException('Undefined attributes', 400);
        }

        // Perform before hook
        $attributes = $this->beforeCreate($attributes);

        // Remove non fillable attributes
        $fields = array_intersect_key($attributes, array_flip($this->fillable));

        // Validate attributes
        $this->setValidationRules();
        $errors = $this->validationErrors($fields);
        if ($errors) {
            throw new Exceptions\ValidationException('Invalid attributes', 400, $errors);
        }

        // Create the model and return its ID
        $result = $this->db()->table($this->table)->insertGetId($fields);

        // Return false if create fails
        if (!$result) {
            throw new \Exception('Could not create the model', 500);
        }

        // Sync many to many relationships
        $this->sync($result, $attributes);

        // Upsert has many relationships
        $this->updateHasMany($result, $attributes);

        // Get the created model
        $model = $this->find($result);

        // Run after hook
        $model = $this->afterCreate($result, $attributes, $model);

        // Return the created model
        return $model;
    }