Skip to content
This repository was archived by the owner on Jul 16, 2023. It is now read-only.
This repository was archived by the owner on Jul 16, 2023. It is now read-only.

Conflict between Eloquent save() and Ardent::save() #307

@james-coder

Description

@james-coder

Similar to #296
I am experiencing problems with Ardent's save function.

It works for me when I do this, but surely there is a better way: (Maybe call Arduent's save something else?)

src/Ardent/Ardent.php:657

//    public function save(array $rules = array(),
//        array $customMessages = array(),
//        array $options = array(),
//        Closure $beforeSave = null,
//        Closure $afterSave = null
//    ) {
//        return $this->internalSave($rules, $customMessages, $options, $beforeSave, $afterSave, false);
//    }

    public function save(Array $arg1 = null)
    {
        if ($arg1 == null) {
           return $this->internalSave([], [], [], null, null, false);
        } else {
           return parent::save($arg1);
        }
    }

Eloquent has two different saves:
Database/Eloquent/Model.php: public function save(array $options = [])
Database/Eloquent/Relations/HasOneOrMany.php: public function save(Model $model)
(also MorphOneOrMany and BelongsToMany)

I encountered this error when following the Laravel seeder documentation here: https://laravel.com/docs/5.5/seeding#writing-seeders

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions