From c6924758091db43ad01bd068018361a00b35e008 Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Sun, 15 Jan 2023 09:14:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=20=E6=88=90=E4=BA=BA?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/User.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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