belongsTo(UserVipRecord::class, 'order_id', 'pay_id'); } public function rechargeOrder() { return $this->belongsTo(UserRechargeRecord::class, 'order_id', 'pay_id'); } public function setTypeNameAttribute($type) { $config = config('global.income_type'); $this->attributes['type_name'] = $config[$type] ?? '未知'; } public function setOrderAttribute(UserShare $share) { $order = 1 == $share->order_type ? $share->vipOrder : $share->rechargeOrder; $this->attributes['order'] = $order; } }