Lets say I have a User, Roles and User_Role table. I have a custom pivot model for my User_Role table. In a User model I have a relation like this
public function roles()
{
return $this->belongsToMany(Role::class, 'User_Role')
->using(UserRole::class);
}
I have a global scope inside UserRole model which is not included in this relation. I could use wherePivot()
and copy the scope but I was wondering is that necessary ?
Is there a way for a BelongsToMany relation to respect global scopes defined inside Pivot model