lundi 4 avril 2016

Save Eloquent model requires to convert to array

I have got the following piece of code inside a Repository class, which saves the model into the DB. However, that fails systematically.

 /**
     * Saves the subscriber
     * @param $subscriber
     * @return void
     */
    public function save($subscriber)
    {
        // \DB::table('subscribers')->insert($subscriber)->toArray();

         //$this->subscriberModel->save($subscriber);
    }

An alternative option that I found is commented out, which fails too.

The exception message that I receive is:

Argument 1 passed to Illuminate\Database\Eloquent\Model::save() must be of the type array, object given, ...

Any thoughts on this one?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire