diff --git a/app/Models/User.php b/app/Models/User.php index 2ef924b..6b5e0bc 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -115,7 +115,8 @@ private function getBirthdayFromIdCard(): string public function isAdult(): bool { - return $this->birthday_at->diffInYears(now()) >= 18; + // 如果 birthday_at 为空,那么就返回 false + return $this->birthday_at?->diffInYears(now()) >= 18; } public function isRealNamed(): bool