123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace App\Models;
- use Tymon\JWTAuth\Contracts\JWTSubject;
- use Illuminate\Notifications\Notifiable;
- use Illuminate\Database\Eloquent\SoftDeletes;
- use Illuminate\Foundation\Auth\User as Authenticatable;
- class User extends Authenticatable implements JWTSubject # 这里别忘了加
- {
- use Notifiable;
- use SoftDeletes;
- protected $guarded=[];
- // protected $fillable=['nickname','name','phone','cre_num','level','openId','unionId','status','avatar','sex','store_id','card_behind_img','card_front_img','remark','password'];
- // Rest omitted for brevity
- /**
- * Get the identifier that will be stored in the subject claim of the JWT.
- *
- * @return mixed
- */
- public function getJWTIdentifier()
- {
- return $this->getKey();
- }
- /**
- * Return a key value array, containing any custom claims to be added to the JWT.
- *
- * @return array
- */
- public function getJWTCustomClaims()
- {
- return [];
- }
- protected $table='user';
- public function store(){
- return $this->hasOne(Store::class,'id','store_id');
- }
- }
|