diff --git a/app/Models/User.php b/app/Models/User.php index 0a29a22..7576c7e 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -128,6 +128,11 @@ private function getBirthdayFromIdCard(): string return $year . '-' . $month . '-' . $day; } + public function hasBalance(string $amount = "0.01"): bool + { + return bccomp($this->balance, $amount, 4) >= 0; + } + public function isAdult(): bool { // 如果 birthday_at 为空,那么就返回 false