调整基地

dev
vine_liutk 2022-11-03 13:41:10 +08:00
parent 07a4c4c261
commit 51c5e7e503
2 changed files with 3 additions and 0 deletions

View File

@ -56,6 +56,7 @@ class AgriculturalBaseController extends Controller
public function show(AgriculturalBase $agriculturalBasic) public function show(AgriculturalBase $agriculturalBasic)
{ {
$agriculturalBasic->load('crops');
return $this->json(AgriculturalBaseResource::make($agriculturalBasic)); return $this->json(AgriculturalBaseResource::make($agriculturalBasic));
} }

View File

@ -18,6 +18,7 @@ class AgriculturalBaseResource extends JsonResource
'id' => $this->id, 'id' => $this->id,
'name' => $this->name, 'name' => $this->name,
'address' => $this->address ?? '', 'address' => $this->address ?? '',
'person' => $this->person ?? '',
'address_lat' => $this->address_lat ?? '', 'address_lat' => $this->address_lat ?? '',
'address_lng' => $this->address_lng ?? '', 'address_lng' => $this->address_lng ?? '',
'description' => $this->description ?? '', 'description' => $this->description ?? '',
@ -25,6 +26,7 @@ class AgriculturalBaseResource extends JsonResource
'areas' => ($this->areas ?? 0.00),//占地面积 'areas' => ($this->areas ?? 0.00),//占地面积
'workforce' => $this->workforce ?? 0,//人数 'workforce' => $this->workforce ?? 0,//人数
'cultivated' =>$this->cultivated ?? 0,//种养殖面积 'cultivated' =>$this->cultivated ?? 0,//种养殖面积
'crops' => CropResource::collection($this->whenLoaded('crops')),
]; ];
} }
} }