1
0
Fork 0
main
vine_liutk 2023-08-30 09:34:58 +08:00
parent 5b332983b4
commit 74ed4b6aea
2 changed files with 4 additions and 1 deletions

View File

@ -28,7 +28,7 @@ class RegionController extends Controller
public function show($id)
{
$info = Region::with(['currentPlant', 'monitorModes'])->show()->findOrFail($id);
$info = Region::with(['currentPlant', 'monitorModes', 'category'])->show()->findOrFail($id);
return $this->json(RegionResource::make($info));
}

View File

@ -22,6 +22,9 @@ class RegionResource extends JsonResource
'area' => $this->area,
'description' => $this->description,
'category_id' => $this->category_id,
'category_name' => $this->whenLoaded('category', function () {
return $this->category->name;
}, ''),
'category' => RegionCategoryResource::make($this->whenLoaded('category')),
'current_plant' => RegionPlantResource::make($this->whenLoaded('currentPlant')),
'position_x'=> $this->position_x,