'一般会员', 2 => '企业会员']; } protected $appends =[ 'member_type_text', ]; public function getMemberTypeTextAttribute() { $list = $this->memberStatus(); if(empty($this->attributes['member_type'])){ return null; } return isset($list[$this->attributes['member_type']]) ? $list[$this->attributes['member_type']] : ''; } //protected $guarded = []; /** * The attributes that should be hidden for arrays. * * @var array */ // protected $hidden = [ // 'password', // 'remember_token', // ]; public function getJWTIdentifier() { return $this->getKey(); // TODO: Implement getJWTIdentifier() method. } public function getJWTCustomClaims() { return [ 'role' => 'user' ]; // TODO: Implement getJWTCustomClaims() method. } /** * 设置密码加密 * @param $value * @return string */ public function setPasswordAttribute($value) { $this->attributes['password'] = bcrypt($value); } public function member(){ return $this->hasOne(UserMember::class,'id','member_id'); } }