src/Database/Queries/Abilities.php
protected static function addRoleInheritCondition(Builder $query, Model $authority, $roles)
    {
        $query->orWhere('level', '<', function ($query) use ($authority, $roles) {
            $query->selectRaw('max(level)')
                  ->from($roles)
                  ->whereExists(static::getAuthorityRoleConstraint($authority));

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

            Models::scope()->applyToModelQuery($query, $roles);
        });
    }
protected static function addRoleInheritCondition ( Builder $ query , Model $ authority , $ roles ) { $ query -> orWhere ( 'level' , '<' , function ( $ query ) use ( $ authority , $ roles ) { $ query -> selectRaw ( 'max(level)' ) -> from ( $ roles ) -> whereExists ( static :: getAuthorityRoleConstraint ( $ authority ) ) ; Models :: scope ( ) -> applyToModelQuery ( $ query , $ roles ) ; } ) ; }
Add the role inheritence "where" clause to the given query.

@param  \Illuminate\Database\Query\Builder  $query
@param  \Illuminate\Database\Eloquent\Model  $authority
@param  string  $roles
@return \Closure
Add the role inheritence where clause to the given query .