fix a bug
This commit is contained in:
+5
-4
@@ -94,10 +94,6 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
|
||||
protected static function booted()
|
||||
{
|
||||
static::retrieved(function (self $user) {
|
||||
$user->use_capacity = $user->images()->sum('size');
|
||||
});
|
||||
|
||||
static::creating(function (self $user) {
|
||||
// 默认组
|
||||
$user->group_id = Group::query()->where('is_default', true)->value('id');
|
||||
@@ -112,6 +108,11 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
return new Attribute(fn () => Utils::getAvatar($this->email));
|
||||
}
|
||||
|
||||
public function useCapacity(): Attribute
|
||||
{
|
||||
return new Attribute(fn () => $this->images()->sum('size'));
|
||||
}
|
||||
|
||||
public function group(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Group::class, 'group_id', 'id');
|
||||
|
||||
Reference in New Issue
Block a user