It appears that a hasManyThrough relationship will not work with a pivot table, is this correct?
This seems to be working but I have no idea if it's the correct way of doing it:
$roles = Auth::user()->role()->with('permission')->get();
foreach ($roles as $role)
{
foreach ($role->permission as $permission)
{
echo $permission->slug;
}
}
Is this the proper way of doing this?
look at Belongs to, you might need to do several of those on the models
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community