123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- <?php
- namespace App\Models;
- use Illuminate\Auth\Authenticatable;
- use Illuminate\Database\Eloquent\SoftDeletes;
- 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','agent_id','recom_id','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 recom_user()
- {
- return $this->belongsTo(User::class,'recom_id');
- }
- /*
- * 用户信息
- * */
- public function user_info()
- {
- return $this->belongsTo(User::class,'user_id');
- }
- /*
- *上级关联
- *
- * */
- public function agent_user()
- {
- return $this->belongsTo(User::class,'agent_id');
- }
- /*
- *代理公司关联
- *
- * */
- public function crown_info()
- {
- return $this->belongsTo(User::class,'crown_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_money(){
- return $this->hasMany(UserPay::class,'user_id','id');
- }
- public function get_moneys(){
- return $this->hasMany(UserPay::class,'user_id','id');
- }
- public function get_moneyss(){
- return $this->hasMany(UserPay::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');
- }
- }
|