Retrieve first data of repository, or return new Entity

@param array $attributes

@return mixed
424580
public function firstOrNew(array $attributes = [])
    {
        $this->applyCriteria();
        $this->applyScope();

        $temporarySkipPresenter = $this->skipPresenter;
        $this->skipPresenter(true);

        $model = $this->model->firstOrNew($attributes);
        $this->skipPresenter($temporarySkipPresenter);

        $this->resetModel();

        return $this->parserResult($model);
    }
1226748
public function forceCreate(array $attributes)
    {
        $instance = $this->model->newInstance()->setConnection(
            $this->query->getConnection()->getName()
        );

        return $this->model->unguarded(function () use ($attributes, $instance) {
            return $instance->create($attributes);
        });
    }
351630
public function create(array $attributes = null)
    {
        $this->doQuery($this->createQuery($attributes));
        $this->{static::$PKFieldName[0]} = static::db()->lastInsertId();
        if ($attributes) {
            $this->fillProperties($attributes);
        }

        return $this;
    }
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;
    }
291159
protected function generateAttrStr( $attributes = array() )
    {
        ksort( $attributes );
        $attrStr = '';
        foreach ( $attributes as $key => $val )
        {
            $attrStr .= '-' . $key . '=' .$val;
        }
        return $attrStr;
    }
1018284
public function create($attributes = array())
    {
        $entity = $this->build($attributes);
        $cond = $this->condition();

        // to SQL.
        $sql = $cond->toInsertSQL($attributes);
        var_dump($sql, $cond->getParams());

        // query.
        $sth = $this->query($sql, $cond->getParams());
        if ( $sth->isSuccess() ) {
            $entity->exists = true;
            $entity->setPrimaryValue($sth->lastInsertId());
            return $entity;
        }
    }
623679
protected function createAndFill(array $attributes)
    {
        $entityClass = static::makes();
        $entity = new $entityClass;

        foreach($attributes as $attribute => $value) {
            $entity->$attribute = $value;
        }

        return $entity;
    }
165283
public function create(array $attributes)
    {
        $instance = $this->related->newInstance($attributes);

        $instance->setAttribute($this->getPlainForeignKey(), $this->getParentKey());

        $instance->save();

        return $instance;
    }
868742
public function update(array $attributes)
    {
        if ($this->related->usesTimestamps()) {
            $attributes[$this->relatedUpdatedAt()] = $this->related->freshTimestampString();
        }

        return $this->query->update($attributes);
    }
1297832
public function make(array $attributes = [])
    {
        if ($this->amount === null) {
            return $this->makeInstance($attributes);
        } else {
            $results = [];

            for ($i = 0; $i < $this->amount; $i++) {
                $results[] = $this->makeInstance($attributes);
            }
            
            return new Collection($results);
        }
    }
63447
public function newFromBuilder($attributes = array())
    {
        $m = $this->mapData((array) $attributes)->newInstance(array(), true);
        $m->setRawAttributes((array) $attributes, true);
        return $m;
    }
87380
public function create(array $attributes = [])
    {
        $results = $this->make($attributes);

        if ($results instanceof Model) {
            $results->save();
        } else {
            $results->each->save();
        }

        return $results;
    }
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,
        ];
    }
1147987
public static function fromArray(array $attributes) {
		unset($attributes['id']);
		
		$attributesObject = new self();
		
		foreach ($attributes as $key => $value) {
			$attributesObject->add($key, $value);
		}
		
		return $attributesObject;
	}
283196
public static function firstOrCreate(array $attributes, array $values = [])
    {
        $static = (new static);
        $hashed_attr = $static->replaceHashableAttributes($attributes);
        $instance = $static->where($hashed_attr)->first();
        if(is_null($instance)) {
            $instance = $static->newModelInstance($attributes + $hashed_attr + $values);
            $instance->save();
        }
        return $instance;
    }
1213951
public function entry(array $attributes = [])
    {
        $model = $this->schema->entryModel();

        return (new $model($attributes, $this->query));
    }
1223840
public static function create(array $attributes)
    {
        $instance = new static;

        $path = $instance->getPath('store');

        return $instance->newQuery()
            ->postField($attributes)
            ->from($path)
            ->create();
    }