getCompanyServices(); } /** * @param $id * @return mixed */ public function getCloud($id) { return $this->getCompanyService($id); } /** * @param $id * @return mixed */ public function getCloudDataCenters($id) { try { $cloud = $this->repository->getById($id); if (!$cloud) { return $this->error404(); } $data_center_regions = $cloud->datacenters_regions(); $res = array(); foreach ($data_center_regions as $region) { $data = $region->toArray(); $locations = $region->locations(); $data_locations = array(); foreach ($locations as $loc) { array_push($data_locations, $loc->toArray()); } $data['locations'] = $data_locations; array_push($res, $data); } return $this->ok(array('datacenters' => $res )); } catch (Exception $ex) { Log::error($ex); return $this->error500($ex); } } }