lundi 27 février 2017

cannot using attach() method in laravel

I have the following relations set up:

public function notes()
{
    return $this->belongsToMany(Note::class);
}


public function tags()
{
    return $this->belongsToMany(Tag::class);
}

and pivot table like this:

Schema::create('note_tag', function (Blueprint $table) {
        $table->engine = 'InnoDB';
        $table->integer('note_id')->unsigned()->index();
        $table->foreign('note_id')->references('id')->on('tags')->onDelete('cascade')->onUpdate('cascade');
        $table->integer('tag_id')->unsigned()->index();
        $table->foreign('tag_id')->references('id')->on('notes')->onDelete('cascade')->onUpdate('cascade');
    });

now, i used Attach() method:

$note->tags()->attach($tagsIds);

but that is not work and get this error:

[Symfony\Component\Debug\Exception\FatalErrorException] Cannot instantiate interface phpDocumentor\Reflection\DocBlock\Tag



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2lgdXZu
via IFTTT

Aucun commentaire:

Enregistrer un commentaire