From 29f5b2a7a976ebbb1c697202ba4f210bc6f1927b Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Mon, 21 Nov 2022 11:29:05 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BA=A7=E9=87=8F=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Resources/CropYieldResource.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Http/Resources/CropYieldResource.php b/app/Http/Resources/CropYieldResource.php index 59aa363..e7b8194 100644 --- a/app/Http/Resources/CropYieldResource.php +++ b/app/Http/Resources/CropYieldResource.php @@ -26,9 +26,11 @@ class CropYieldResource extends JsonResource 'crop_id' => $this->crop_id, 'time_year' => $this->time_year, 'quarter' => $this->quarter, - 'yield' => $this->yield, - 'output' => $this->output, - 'cultivated' => $this->cultivated, + 'yield' => $this->yield.$this->whenLoaded('crop', function () { + return $this->crop?->unit ?? ''; + }, ''), + 'output' => $this->output.'元', + 'cultivated' => $this->cultivated.'亩', 'extends' => $this->extends, 'created_by' => $this->whenLoaded('createdBy', function () { return $this->createdBy?->name;