@@ -42,6 +42,11 @@ class GenerateDocumentation extends Command
4242 */
4343 private $ docConfig ;
4444
45+ /**
46+ * @var string
47+ */
48+ private $ baseUrl ;
49+
4550 public function __construct (RouteMatcher $ routeMatcher )
4651 {
4752 parent ::__construct ();
@@ -60,9 +65,10 @@ public function handle()
6065 Flags::$ shouldBeVerbose = $ this ->option ('verbose ' );
6166
6267 $ this ->docConfig = new DocumentationConfig (config ('apidoc ' ));
68+ $ this ->baseUrl = $ this ->docConfig ->get ('base_url ' ) ?? config ('app.url ' );
6369
6470 try {
65- URL ::forceRootUrl ($ this ->docConfig -> get ( ' base_url ' ) );
71+ URL ::forceRootUrl ($ this ->baseUrl );
6672 } catch (\Error $ e ) {
6773 echo "Warning: Couldn't force base url as your version of Lumen doesn't have the forceRootUrl method. \n" ;
6874 echo "You should probably double check URLs in your generated documentation. \n" ;
@@ -111,7 +117,7 @@ private function writeMarkdown($parsedRoutes)
111117 $ route ['output ' ] = (string ) view ('apidoc::partials.route ' )
112118 ->with ('route ' , $ route )
113119 ->with ('settings ' , $ settings )
114- ->with ('baseUrl ' , $ this ->docConfig -> get ( ' base_url ' ) )
120+ ->with ('baseUrl ' , $ this ->baseUrl )
115121 ->render ();
116122
117123 return $ route ;
@@ -288,7 +294,7 @@ private function isRouteVisibleForDocumentation($action)
288294 */
289295 private function generatePostmanCollection (Collection $ routes )
290296 {
291- $ writer = new CollectionWriter ($ routes , $ this ->docConfig -> get ( ' base_url ' ) );
297+ $ writer = new CollectionWriter ($ routes , $ this ->baseUrl );
292298
293299 return $ writer ->getCollection ();
294300 }
0 commit comments