public static function getStoredContentForService(Service $service) { // check the database records for custom doc in swagger, raml, etc. $info = $service->serviceDocs()->first(); $content = isset($info) ? $info->content : null; if (is_string($content)) { $content = json_decode($content, true); } else { $serviceClass = $service->serviceType()->first()->class_name; $settings = $service->toArray(); /** @var BaseRestService $obj */ $obj = new $serviceClass($settings); $content = $obj->getApiDocInfo(); } return $content; }