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 = $share->order_type == 1 ? $share->vipOrder : $share->rechargeOrder; $this->attributes['order'] = $order; } }