增加下级数
This commit is contained in:
@@ -5,6 +5,8 @@ namespace App\Models;
|
||||
use App\Models\Traits\HasAccount;
|
||||
use App\Models\Traits\HasArea;
|
||||
use DateTimeInterface;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -78,18 +80,18 @@ class User extends Authenticatable
|
||||
return $date->format($this->dateFormat ?: 'Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
protected function getNicknameAttribute()
|
||||
protected function getNicknameAttribute(): string
|
||||
{
|
||||
return $this->info ? $this->info->nickname : '';
|
||||
}
|
||||
|
||||
public function info()
|
||||
public function info(): HasOne
|
||||
{
|
||||
return $this->hasOne(UserInfo::class);
|
||||
}
|
||||
|
||||
//渠道商配置
|
||||
public function code()
|
||||
public function code(): HasMany
|
||||
{
|
||||
return $this->hasMany(UserCode::class);
|
||||
}
|
||||
@@ -99,6 +101,11 @@ class User extends Authenticatable
|
||||
return $this->hasOne(User::class, 'id', 'parent_id');
|
||||
}
|
||||
|
||||
public function children(): hasMany
|
||||
{
|
||||
return $this->hasMany(User::class, 'parent_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 密码加密
|
||||
* @Author: <C.Jason>
|
||||
|
||||
Reference in New Issue
Block a user