attributes['currency']; $realNum = $this->attributes['real_number']; $price=Currency::where('id',$cid)->first()->price??1; $usdtRate=Setting::getValueByKey('USDTRate'); return $realNum*$price*$usdtRate; } public function getBankNameAttribute() { return $this->hasOne('App\UserCashInfo', 'user_id', 'user_id')->value('bank_name'); } public function getBankAccountAttribute() { return $this->hasOne('App\UserCashInfo', 'user_id', 'user_id')->value('bank_account'); } public function getBankBranchAttribute() { return $this->hasOne('App\UserCashInfo', 'user_id', 'user_id')->value('bank_branch'); } public function getRealNameAttribute() { return $this->hasOne('App\UserCashInfo', 'user_id', 'user_id')->value('real_name'); } public function getCurrencyNameAttribute() { return $this->hasOne('App\Currency', 'id', 'currency')->value('name'); } public function getCurrencyTypeAttribute() { return $this->hasOne('App\Currency', 'id', 'currency')->value('type'); } public function getAccountNumberAttribute() { return $this->hasOne('App\Users', 'id', 'user_id')->value('account_number'); } // public function getRealNumberAttribute() // { // // return $this->attributes['number']*(1-$this->attributes['rate']); // return bcmul($this->attributes['number'], (1 - $this->attributes['rate'] / 100), 8); // } public function getCreateTimeAttribute() { $value = $this->attributes['create_time']; return $value ? date('Y-m-d H:i:s', $value) : ''; } public function user() { return $this->belongsTo(Users::class, 'user_id', 'id')->withDefault(); } }