问题描述
假设我有一个 User、Roles 和 User_Role 表。我的 User_Role 表有一个自定义数据透视模型。在用户模型中,我有这样的关系
public function roles()
{
return $this->belongsToMany(Role::class,'User_Role')
->using(UserRole::class);
}
我在 UserRole 模型中有一个全局范围,该范围不包含在此关系中。我可以使用 wherePivot()
并复制范围,但我想知道这有必要吗?
有没有办法让 BelongsToMany 关系尊重 Pivot 模型中定义的全局范围
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)