12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?php
- namespace App\Models;
- use Tymon\JWTAuth\Contracts\JWTSubject;
- use Illuminate\Notifications\Notifiable;
- use Illuminate\Foundation\Auth\User as Authenticatable;
- use Auth;
- use Spatie\Permission\Traits\HasRoles;
- /**
- * 这个类要继承接口-用户 model
- * Class User
- * @package App\Models
- */
- class User extends Authenticatable implements JWTSubject
- {
- use Notifiable;
- protected $table = 'vr_users';
- /**
- * The attributes that are mass assignable.
- *
- * @var array
- */
- protected $fillable = [
- 'open_id', 'phone', 'user_type', 'real_name', 'nick_name', 'avatar_url', 'gender', 'birthday', 'password', 'session_key', 'country', 'province', 'city', 'is_graduate', 'website_id', 'become_member_time','carbon_emission',
- ];
- /**
- * The attributes that should be hidden for arrays.
- *
- * @var array
- */
- protected $hidden = [
- 'password',
- ];
- /**
- * The attributes that should be cast to native types.
- *
- * @var array
- */
- protected $casts = [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'deleted_at' => 'datetime',
- ];
- 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 routeNotificationForEasySms()
- {
- return $this->phone;
- }
- public function userCourses()
- {
- return $this->hasMany(UserCourses::class);
- }
- public function userWebsites()
- {
- // return $this->hasOne(Website::class,'id','website_id');
- return $this->belongsTo(Website::class, 'id', 'website_id');
- }
- }
|