Answer the question
In order to leave comments, you need to log in
How to make a connection through the model?
There are User, Artist and Album.
Album hasMany Artist via albums_artists table. Here is the connection:
// Album
public function artists()
{
return $this->belongsToMany(Artist::class);
}
// Artist
public function users()
{
return $this->belongsToMany(User::class);
}
// Album
public function users()
{
// ??
}
Answer the question
In order to leave comments, you need to log in
You describe the hasManyThrough relationship, not hasMany. Read about it in the documentation, everything is clear there.
Hello, it seems that this video has the answer, at 6 minutes
https://www.youtube.com/watch?v=PgRcyJe76C8&list=P...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question