I have list of departments that a user can belong to and a list of projects that can belong to many departments. I have set up the belongsToMany relationships for all of these and can access the list of user departments easily as follows:
and also the list of projects for each department:
but when I chain them together:
or combinations thereof e.g.
I get the error Call to undefined method Illuminate\Database\Eloquent\Relations\BelongsToMany::projects().
Any ideas where I am going wrong?