| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 | <?phpnamespace App\Models;use Dcat\Admin\Traits\HasDateTimeFormatter;use Illuminate\Database\Eloquent\SoftDeletes;use Illuminate\Foundation\Auth\User as Authenticatable;use Illuminate\Notifications\Notifiable;use PHPOpenSourceSaver\JWTAuth\Contracts\JWTSubject;class User extends Authenticatable implements JWTSubject{    use Notifiable,HasDateTimeFormatter,SoftDeletes;    /**     * The attributes that are mass assignable.     *     * @var array     */    protected $fillable = [        'nickname',        'email',        'avatar',        'password',        'mobile',        'open_id',        'union_id'    ];    //protected $guarded = [];    /**     * The attributes that should be hidden for arrays.     *     * @var array     */    // protected $hidden = [    //     'password',    //     'remember_token',    // ];    public function getJWTIdentifier()    {        return $this->getKey(); // TODO: Implement getJWTIdentifier() method.    }    public function getJWTCustomClaims()    {        return [            'role' => 'user'        ];  // TODO: Implement getJWTCustomClaims() method.    }    /**     * 设置密码加密     * @param $value     * @return string     */    public function setPasswordAttribute($value)    {        $this->attributes['password'] = bcrypt($value);    }}
 |