Ich habe setzen die folgenden Beziehungen auf:kann nicht anhängen() -Methode in Laravel
public function notes()
{
return $this->belongsToMany(Note::class);
}
public function tags()
{
return $this->belongsToMany(Tag::class);
}
und Pivot-Tabelle wie folgt aus:
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');
});
jetzt, habe ich Attach() -Methode:
$note->tags()->attach($tagsIds);
aber das nicht funktioniert und ich bekomme diese Fehlermeldung:
[Symfony\Component\Debug\Exception\FatalErrorException] Cannot instantiate interface phpDocumentor\Reflection\DocBlock\Tag
vielen Dank – narges