| 14 | use Tymon\JWTAuth\Contracts\JWTSubject; |
| 15 | |
| 16 | class User extends Authenticatable implements JWTSubject |
| 17 | { |
| 18 | use Notifiable; |
| 19 | protected $table = 'chihe_user'; |
| 20 | protected $fillable = [ |
| 21 | 'id', |
| 22 | 'open_id', |
| 23 | 'created_at', |
| 24 | 'is_deleted', |
| 25 | 'updated_at', |
| 26 | 'nickname', |
| 27 | 'avatar', |
| 28 | 'city', |
| 29 | 'gender', |
| 30 | 'ref_uid', //推荐人ID |
| 31 | 'get_coupon_num', |
| 32 | 'subscribe_num' |
| 33 | ]; |
| 34 | |
| 35 | static function userStatus($type = null) |
| 36 | { |
| 37 | $status = [ |
| 38 | 1 => '冻结', |
| 39 | 2 => '正常', |
| 40 | ]; |
| 41 | return $status[$type] ?? $status; |
| 42 | } |
| 43 | //用户类型 |
| 44 | static function userType($type = null) |
| 45 | { |
| 46 | $userTypes = [ |
| 47 | 0 => '使用会员', |
| 48 | 1 => '高级会员', |
| 49 | 2 => '终生会员', |
| 50 | ]; |
| 51 | return $userTypes[$type] ?? $userTypes; |
| 52 | } |
| 53 | const UPDATED_AT = null; |
| 54 | |
| 55 | public function getJWTIdentifier() |
| 56 | { |
| 57 | return $this->getKey(); |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * Return a key value array, containing any custom claims to be added to the JWT. |
| 62 | * |
| 63 | * @return array |
| 64 | */ |
| 65 | public function getJWTCustomClaims() |
| 66 | { |
| 67 | return []; |
| 68 | } |
| 69 | |
| 70 | } |
| 71 |
nothing calls this directly
no outgoing calls
no test coverage detected