diff --git a/beike/Models/Rma.php b/beike/Models/Rma.php index a15e4d65..9fdfd3bb 100644 --- a/beike/Models/Rma.php +++ b/beike/Models/Rma.php @@ -38,7 +38,7 @@ class Rma extends Base public function reason() :BelongsTo { - return $this->belongsTo(RmaReason::class)->where('locale', locale()); + return $this->belongsTo(RmaReason::class, 'rma_reason_id', 'id')->where('locale', locale()); } public function histories() :HasMany diff --git a/beike/Shop/Http/Resources/RmaDetail.php b/beike/Shop/Http/Resources/RmaDetail.php index 828b59b2..52eb182d 100644 --- a/beike/Shop/Http/Resources/RmaDetail.php +++ b/beike/Shop/Http/Resources/RmaDetail.php @@ -31,7 +31,7 @@ class RmaDetail extends JsonResource 'product_name' => $this->product_name, 'name' => $this->name, 'sku' => $this->sku, - 'reason' => $this->reason, + 'reason' => $this->reason->name, 'type_text' => $this->type_text, ]; }