- $exampleFile = base_path("dev/api/{$exampleType}s/{$route['name']}.json");
- $exampleContent = file_exists($exampleFile) ? file_get_contents($exampleFile) : null;
- $route["example_{$exampleType}"] = $exampleContent;
+ foreach ($fileTypes as $fileType) {
+ $exampleFile = base_path("dev/api/{$exampleType}s/{$route['name']}." . $fileType);
+ if (file_exists($exampleFile)) {
+ $route["example_{$exampleType}"] = file_get_contents($exampleFile);
+ continue 2;
+ }
+ }
+ $route["example_{$exampleType}"] = null;