public function hasRole($role, $requireAll = false)
    {
        if ($user = $this->user()) {
            return $user->hasRole($role, $requireAll);
        }

        return false;
    }
public function hasRole($role, $requireAll = false)
    {
        if ($user = $this->user()) {
            return $user->hasRole($role, $requireAll);
        }

        return false;
    }
public function hasRole ( $ role , $ requireAll = false ) { if ( $ user = $ this -> user ( ) ) { return $ user -> hasRole ( $ role , $ requireAll ) ; } return false ; }
Checks if the current user has a role by its name

@param string $name Role name.

@return bool
Checks if the current user has a role by its name