LMongo\Eloquent\Relations\MorphOneOrMany::create PHP Метод

create() публичный Метод

Create a new instance of the related model.
public create ( array $attributes ) : Model
$attributes array
Результат LMongo\Eloquent\Model
    public function create(array $attributes)
    {
        $foreign = array($this->foreignKey => new MongoID($this->parent->getKey()));
        // When saving a polymorphic relationship, we need to set not only the foreign
        // key, but also the foreign key type, which is typically the class name of
        // the parent model. This makes the polymorphic item unique in the table.
        $foreign[$this->morphType] = $this->morphClass;
        $attributes = array_merge($attributes, $foreign);
        $instance = $this->related->newInstance($attributes);
        $instance->save();
        return $instance;
    }