Hello @tobisch1591,
From the documentation:
To determine the table name of the relationship's intermediate table, Eloquent will join the two related model names in alphabetical order. However, you are free to override this convention. You may do so by passing a second argument to the belongsToMany method:
With that convention the table should be named language_user
but it is possible to change it.
I suspect you have a method languages
on your user model, there you can add the table as second argument.
public function languages()
{
return $this->belongsToMany(Language::class, 'user_language');
}
I think that is enough to help you (and if you have defined the relation on your Language model you can also use the second parameter on that place.)
Ps. I have updated your post to make the code blocks more readable.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community