info()->create(); }); } public function getJWTIdentifier() { return $this->getKey(); } public function getJWTCustomClaims() { return []; } /** * 修改支付密码,留空则不修改 * @param void */ protected function setPasswordAttribute($password) { if ($password) { $this->attributes['password'] = bcrypt($password); } } /** * 我的资料 * @Author: * @Date:2019-04-26T11:11:45+0800 * @return [type] [description] */ public function info() { return $this->hasOne(UserInfo::class)->withDefault(); } /** * 我的订单 * @Author: * @Date:2019-04-26T11:11:39+0800 * @return [type] [description] */ public function orders() { return $this->hasMany(Order::class); } /** * 提现记录 * @return [type] [description] */ public function withdraws() { return $this->hasMany(Withdraw::class); } public function needBuy() { $identity_id = $this->identity->identity_id; if ($identity_id == 0) { return true; } if ($identity_id == 1 && empty($this->vip_end_at)) { return true; } if ($identity_id == 1 && $this->vip_end_at->timestamp < time()) { return true; } return false; } }