diff --git a/beike/Models/Rma.php b/beike/Models/Rma.php index 9fdfd3bb..b420afc1 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, 'rma_reason_id', 'id')->where('locale', locale()); + return $this->belongsTo(RmaReason::class, 'rma_reason_id', 'id'); } public function histories() :HasMany diff --git a/beike/Shop/Http/Controllers/Account/RmaController.php b/beike/Shop/Http/Controllers/Account/RmaController.php index 687f40fa..cb9e2a15 100644 --- a/beike/Shop/Http/Controllers/Account/RmaController.php +++ b/beike/Shop/Http/Controllers/Account/RmaController.php @@ -12,10 +12,10 @@ namespace Beike\Shop\Http\Controllers\Account; use App\Http\Controllers\Controller; -use Beike\Shop\Http\Resources\RmaReasonDetail; use Beike\Repositories\RmaReasonRepo; use Beike\Repositories\RmaRepo; use Beike\Shop\Http\Requests\RmaRequest; +use Beike\Shop\Http\Resources\Account\RmaReasonDetail; use Beike\Shop\Services\RmaService; use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\View\Factory; diff --git a/beike/Shop/Http/Resources/Account/RmaReasonDetail.php b/beike/Shop/Http/Resources/Account/RmaReasonDetail.php index 18e38387..79a9fe1e 100644 --- a/beike/Shop/Http/Resources/Account/RmaReasonDetail.php +++ b/beike/Shop/Http/Resources/Account/RmaReasonDetail.php @@ -9,7 +9,7 @@ * @modified 2022-08-31 11:56:28 */ -namespace Beike\Shop\Http\Resources; +namespace Beike\Shop\Http\Resources\Account; use Illuminate\Http\Resources\Json\JsonResource; diff --git a/beike/Shop/Http/Resources/RmaDetail.php b/beike/Shop/Http/Resources/RmaDetail.php index 13d76e63..04599e9e 100644 --- a/beike/Shop/Http/Resources/RmaDetail.php +++ b/beike/Shop/Http/Resources/RmaDetail.php @@ -35,7 +35,7 @@ class RmaDetail extends JsonResource 'product_name' => $this->product_name, 'name' => $this->name, 'sku' => $this->sku, - 'reason' => $this->reason->name ?? '', + 'reason' => json_decode($this->reason->name, true)[locale()] ?? '', 'type_text' => $this->type_text, ]; }