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

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

Open
james-coder opened this issue Oct 23, 2017 · 0 comments
Open

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

james-coder opened this issue Oct 23, 2017 · 0 comments

Comments

@james-coder
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant