'integer', 'score' => 'integer', 'avatar' => 'integer', 'permission' => 'integer', 'verified' => 'bool', ]; protected $hidden = ['password', 'remember_token']; protected $searchStringColumns = [ 'uid', 'email' => ['searchable' => true], 'nickname' => ['searchable' => true], 'avatar', 'score', 'permission', 'ip', 'last_sign_at' => ['date' => true], 'register_at' => ['date' => true], 'verified' => ['boolean' => true], ]; public function isAdmin(): bool { return $this->permission >= static::ADMIN; } public function closet() { return $this->belongsToMany(Texture::class, 'user_closet')->withPivot('item_name'); } public function getPlayerNameAttribute() { $player = $this->players->first(); return $player ? $player->name : ''; } public function setPlayerNameAttribute($value) { $player = $this->players->first(); if ($player) { $player->name = $value; $player->save(); } } public function delete() { Player::where('uid', $this->uid)->delete(); return parent::delete(); } public function players() { return $this->hasMany(Player::class, 'uid'); } public function getAuthIdentifier() { return $this->uid; } public function getJWTIdentifier() { return $this->getKey(); } public function getJWTCustomClaims() { return []; } }