From 1081455c23afed3866a7e9a6c7680fc912af7b1f Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Mon, 30 Jan 2023 22:51:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/User.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Models/User.php b/app/Models/User.php index 7576c7e..0d932a1 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -8,6 +8,7 @@ use GeneaLabs\LaravelModelCaching\CachedBuilder; use GeneaLabs\LaravelModelCaching\Traits\Cachable; use Illuminate\Contracts\Encryption\DecryptException; +use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Relations\BelongsTo; @@ -149,20 +150,20 @@ public function user_group(): BelongsTo return $this->belongsTo(UserGroup::class); } - public function scopeBirthday(): User|CachedBuilder + public function scopeBirthday(): Builder|CachedBuilder { /** @noinspection PhpUndefinedMethodInspection */ return $this->select(['id', 'name', 'birthday_at', 'email_md5', 'created_at'])->whereMonth('birthday_at', now()->month) ->whereDay('birthday_at', now()->day)->whereNull('banned_at'); } - public function selectPublic(): User + public function selectPublic(): self|Builder|CachedBuilder { // 仅需选择公开的 return $this->select($this->publics); } - public function startTransfer(User $to, string $amount, string|null $description) + public function startTransfer(self $to, string $amount, string|null $description) { $description_from = "转账给 $to->name($to->email)"; $description_to = "收到 $this->name($this->email) 的转账";