ORT-Interactive-GmbH / laravel-couchbase

A Couchbase based Eloquent model and Query builder for Laravel
40 stars 25 forks source link

Impossible to save embed documents #51

Open matthiouze opened 4 years ago

matthiouze commented 4 years ago

Hello,

I've installed the package, I've followed the documentation and it does not work. Here is my code :

namespace App;

use Mpociot\Couchbase\Eloquent\Model as Eloquent;

class Parent extends Eloquent
{
    protected $table = 'parents';

    //-----------------------------------------------------------------------------------
    public function child()
    {
        return $this->embedsMany(Child::class);
    }

    //-----------------------------------------------------------------------------------
    public function user()
    {
        return $this->belongsTo(User::class, 'user_id');
    }
}

$parent                       = new Parent;
$parent->name          = $request->name;
$parent->description = $request->description;

$parent->user()->associate($request->user());

$parent->save();

$child               = new Child;
$child->name  = 'test 1';

$parent->child()->save($child);

When I execute this code I have this error :

Declaration of Mpociot\Couchbase\Relations\EmbedsOneOrMany::get() should be compatible with Illuminate\Database\Eloquent\Relations\Relation::get($columns = Array)

Am I missing something ?