main
parent
5b332983b4
commit
74ed4b6aea
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue