return the most supurior role for a user

@return Lembarek\Role\Models\Role
191332
public function maxRole()
    {
        $roles = $this->roles;
        $r = $roles->first();

        foreach ($roles as $role){
            if($role->order > $r->order)
                $r = $role;
        }

        return $r;
    }
1035832
public function getRole()
    {
        $id = $this->getId();

        if (strpos($id, 'ROLE_') === 0) {
            return strtoupper($id);
        }

        return strtoupper('ROLE_' . $this->getId());
    }
296961
public function getRoles()
    {
        $roles = array();
        foreach ($this->groups as $group) {
            $roles[] = $group->getAsRole();
        }
        $roles[] = 'ROLE_USER';
        return $roles;
    }
971171
public function getRoles()
    {
        if(!$this->roles){
            $this->roles = $this->grantedRoles()->get();

            $deniedRoles = $this->deniedRoles()->get();
            foreach($deniedRoles as $role)
                $deniedRoles = $deniedRoles->merge($role->descendants());

            foreach($this->roles as $role)
                if(!$deniedRoles->contains($role))
                    $this->roles = $this->roles->merge($role->descendants());

            $this->roles = $this->roles->filter(function($role) use ($deniedRoles){
                return !$deniedRoles->contains($role);
            });
        }
        return  $this->roles;
    }
458502
public function roles()
    {
        return $this->belongsToMany(
            Config::get('laratrust.models.role'),
            Config::get('laratrust.tables.permission_role'),
            Config::get('laratrust.foreign_keys.permission'),
            Config::get('laratrust.foreign_keys.role')
        );
    }
271745
public function getMentionRolesAttribute()
    {
        $roles = new Collection([], 'id');

        foreach ($this->channel->guild->roles as $role) {
            if (array_search($role->id, $this->attributes['mention_roles']) !== false) {
                $roles->push($role);
            }
        }

        return $roles;
    }
804747
public function roleList()
    {
        $body = $this->request(self::URI_AUTH_ROLE_LIST);

        if ($this->pretty && isset($body['roles'])) {
            return $body['roles'];
        }

        return $body;
    }
978376
public function getRolesNames ()
		{
			$auth = Yii::$app->getAuthManager();
			$rolesByUser = $auth->getRolesByUser($this->id);
			$roles = ArrayHelper::objectsAttribute($rolesByUser, 'name');

			return $roles;
		}
770330
function getHighestRole() {
        return $this->roles->reduce(function ($prev, $role) {
            if($prev === null) {
                return $role;
            }
            
            return ($role->comparePositionTo($prev) > 0 ? $role : $prev);
        });
    }
1187601
public function getImpersonatingUser()
    {
        if ($this->isGranted('ROLE_PREVIOUS_ADMIN')) {
            foreach ($this->tokenStorage->getToken()->getRoles() as $role) {
                if ($role instanceof SwitchUserRole) {
                    return $role->getSource()->getUser();
                }
            }
        }
    }
745708
public function getRole() : ?string 
    {
        if ( ! $this->hasRole()) {
            $this->setRole($this->getDefaultRole());
        }
        return $this->role;
    }
241181
public function index()
    {
        $this->authorize(RolesPolicy::PERMISSION_LIST);

        $roles = $this->role->withCount(['users', 'permissions'])->paginate(30);

        $this->setTitle($title = trans('auth::roles.titles.roles-list'));
        $this->addBreadcrumb($title);

        return $this->view('admin.roles.index', compact('roles'));
    }
273755
public function getRole()
	{
		if ($this->_user === NULL) {
			$this->_initUser();
		}

		if ($this->_user->getRole()) {
			return $this->_user->getRole();
		}

		return Acl::DEFAULT_ROLE;
	}
917184
function fetchUserByRole( )
    {
        $db = eZDB::instance();

        $query = "SELECT
                     ezuser_role.contentobject_id as user_id,
                     ezuser_role.limit_value,
                     ezuser_role.limit_identifier,
                     ezuser_role.id
                  FROM
                     ezuser_role
                  WHERE
                    ezuser_role.role_id = '$this->ID'";

        $userRoleArray = $db->arrayQuery( $query );
        $userRoles = array();
        foreach ( $userRoleArray as $userRole )
        {
            $role = array();
            $role['user_object'] = eZContentObject::fetch( $userRole['user_id'] );
            $role['user_role_id'] = $userRole['id'];
            $role['limit_ident'] = $userRole['limit_identifier'];
            $role['limit_value'] = $userRole['limit_value'];

            $userRoles[] = $role;
        }
        return $userRoles;
    }
716504
public function getRoles()
    {
        $roles = parent::getRoles();

        foreach ($this->getUserRoles() as $userRole) {
            /* @var UserRole $userRole */
            $roles[] = $userRole->getRole()->getIdentifier();
        }

        return $roles;
    }
1105231
public function getUserRoles() {
        $returnValue = $this->internalSession->getUserRoles();
        foreach (array_keys($returnValue) as $key) {
            $role = $returnValue[$key];
            if (!in_array($role, $this->filter)) {
                unset($returnValue[$key]);
            }
        }
        return $returnValue;
    }
539310
public function roles()
    {
        $roles = $this->morphToMany(
            Config::get('laratrust.models.role'),
            'user',
            Config::get('laratrust.tables.role_user'),
            Config::get('laratrust.foreign_keys.user'),
            Config::get('laratrust.foreign_keys.role')
        );

        if (Config::get('laratrust.use_teams')) {
            $roles->withPivot(Config::get('laratrust.foreign_keys.team'));
        }

        return $roles;
    }