protected function addRoleInheritCondition(Builder $query, Model $authority, $roles)
{
$query->orWhere('level', '<', function ($query) use($authority, $roles) {
$query->selectRaw('max(level)')->from($roles)->whereExists($this->getAuthorityRoleConstraint($authority));
});
}