diff --git a/src/Account/Services/Auth/SessionAuthentication.php b/src/Account/Services/Auth/SessionAuthentication.php index 844291f..4f832d6 100644 --- a/src/Account/Services/Auth/SessionAuthentication.php +++ b/src/Account/Services/Auth/SessionAuthentication.php @@ -153,7 +153,10 @@ class SessionAuthentication implements AuthenticationInterface // 已匹配到时返回指定字段或整个用户信息 if ($column !== null) { if (!isset($user[$column])) { - throw new InvalidArgumentException('属性不存在'); + if ($returnNull) { + return null; + } + throw new InvalidArgumentException("属性 $column 不存在"); } return $user[$column];