123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <?php
- namespace App\Models;
- use Illuminate\Auth\Authenticatable;
- use Illuminate\Database\Eloquent\SoftDeletes;
- use Illuminate\Support\Facades\Crypt;
- use Laravel\Lumen\Auth\Authorizable;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
- use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
- use Tymon\JWTAuth\Contracts\JWTSubject;
- class User extends Model implements AuthenticatableContract, AuthorizableContract, JWTSubject
- {
- use Authenticatable, Authorizable;
- protected $connection = 'mysql';
- /**
- * The attributes that are mass assignable.
- *
- * @var array
- */
- // use SoftDeletes;
- protected $fillable = [
- 'wechatname','nickname','realname','avatar','openid','unionid','cre_num','level','status','cert_status','recom_code','sex','service_time','service_end_time','register_time','area_code','mobile','auth_code','remark_name','headimgurl','password','freeze_status','login_at','freeze_time','h5_num','mini_num','is_five_type'
- ];
- /**
- * The attributes that should be hidden for arrays.
- *
- * @var array
- */
- protected $hidden = [
- 'password'
- ];
- /**
- * 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 [];
- }
- /*
- * 用户信息
- * */
- public function user_info()
- {
- return $this->belongsTo(User::class,'user_id');
- }
- /*
- * 认证表信息
- * */
- public function cert_info(){
- return $this->belongsTo(UserCert::class,'id','user_id');
- }
- public function cert_user(){
- return $this->hasOne(UserCert::class,'user_id','id');
- }
- public function get_order(){
- return $this->hasMany(Ordertest::class,'user_id','id');
- }
- public function get_store(){
- return $this->hasOne(Store::class,'user_id','id');
- }
- }
|