소스 검색

Fix #509 - No forceRootURL method in Lumen

shalvah 6 년 전
부모
커밋
2146fa114d
1개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      src/Commands/GenerateDocumentation.php

+ 6 - 1
src/Commands/GenerateDocumentation.php

@@ -47,7 +47,12 @@ class GenerateDocumentation extends Command
      */
     public function handle()
     {
-        URL::forceRootUrl(config('app.url'));
+        try {
+            URL::forceRootUrl(config('app.url'));
+        } catch (\Exception $e) {
+            echo "Warning: Couldn't force base url as Lumen currently doesn't have the forceRootUrl method.\n";
+            echo "You should probably double check URLs in your generated documentation.\n";
+        }
         $usingDingoRouter = strtolower(config('apidoc.router')) == 'dingo';
         if ($usingDingoRouter) {
             $routes = $this->routeMatcher->getDingoRoutesToBeDocumented(config('apidoc.routes'));