belongsTo(User::class); } /** * 转账记录 * * @return void */ public function scopeOnlyTransfer($query) { return $query->whereIn('action', [self::ACTION_TRANSFER_OUT, self::ACTION_TRANSFER_IN]); } /** * 获取变动金额 * * @return string */ public function getChangeBalanceFormatAttribute() { return trim_trailing_zeros(bcdiv($this->attributes['change_balance'], 100, 2)); } }