src/Auth/AuthUserTrait.php
public function hasRoles($expectedRoles, $oneRoleIsEnough = true, $providedRoles = null) {
		if ($providedRoles !== null) {
			$roles = $providedRoles;
		} else {
			$roles = $this->roles();
		}

		$expectedRoles = (array)$expectedRoles;
		if (!$expectedRoles) {
			return false;
		}

		$count = 0;
		foreach ($expectedRoles as $expectedRole) {
			if ($this->hasRole($expectedRole, $roles)) {
				if ($oneRoleIsEnough) {
					return true;
				}
				$count++;
			} else {
				if (!$oneRoleIsEnough) {
					return false;
				}
			}
		}

		if ($count === count($expectedRoles)) {
			return true;
		}
		return false;
	}
public function hasRoles($expectedRoles, $oneRoleIsEnough = true, $providedRoles = null) {
		if ($providedRoles !== null) {
			$roles = $providedRoles;
		} else {
			$roles = $this->roles();
		}

		$expectedRoles = (array)$expectedRoles;
		if (!$expectedRoles) {
			return false;
		}

		$count = 0;
		foreach ($expectedRoles as $expectedRole) {
			if ($this->hasRole($expectedRole, $roles)) {
				if ($oneRoleIsEnough) {
					return true;
				}
				$count++;
			} else {
				if (!$oneRoleIsEnough) {
					return false;
				}
			}
		}

		if ($count === count($expectedRoles)) {
			return true;
		}
		return false;
	}
public function hasRoles ( $ expectedRoles , $ oneRoleIsEnough = true , $ providedRoles = null ) { if ( $ providedRoles !== null ) { $ roles = $ providedRoles ; } else { $ roles = $ this -> roles ( ) ; } $ expectedRoles = ( array ) $ expectedRoles ; if ( ! $ expectedRoles ) { return false ; } $ count = 0 ; foreach ( $ expectedRoles as $ expectedRole ) { if ( $ this -> hasRole ( $ expectedRole , $ roles ) ) { if ( $ oneRoleIsEnough ) { return true ; } $ count ++ ; } else { if ( ! $ oneRoleIsEnough ) { return false ; } } } if ( $ count === count ( $ expectedRoles ) ) { return true ; } return false ; }
Check if the current session has one of these roles.

You can either require one of the roles (default), or you can require all
roles to match.

@param mixed $expectedRoles
@param bool $oneRoleIsEnough (if all $roles have to match instead of just one)
@param mixed|null $providedRoles
@return bool Success
Check if the current session has one of these roles .