Please show all your models and your tag() execution. And whats the name of the m:n-table?
For some "magic", call your relation table tag_user. This way Eloquent will find it on its own.
For setting your relations in the models, use belongsToMany in both models.
// In User model
public function tag()
{
return $this->belongsToMany('App\Tag');
}
// In Tag model
public function user()
{
return $this->belongsToMany('App\User');
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community