66use Illuminate \Http \Request ;
77use Illuminate \Http \Testing \File ;
88use Illuminate \Support \Arr ;
9+ use Illuminate \Support \Facades \URL ;
910use Illuminate \Support \Str ;
1011use ReflectionClass ;
1112use RonasIT \AutoDoc \Exceptions \DocFileNotExistsException ;
@@ -140,7 +141,7 @@ protected function generateEmptyData(): array
140141 $ data = [
141142 'openapi ' => self ::OPEN_API_VERSION ,
142143 'servers ' => [
143- ['url ' => $ this -> getAppUrl () . $ this ->config ['basePath ' ]],
144+ ['url ' => URL :: query ( $ this ->config ['basePath ' ]) ],
144145 ],
145146 'paths ' => [],
146147 'components ' => [
@@ -158,13 +159,6 @@ protected function generateEmptyData(): array
158159 return $ data ;
159160 }
160161
161- protected function getAppUrl (): string
162- {
163- $ url = config ('app.url ' );
164-
165- return str_replace (['http:// ' , 'https:// ' , '/ ' ], '' , $ url );
166- }
167-
168162 protected function generateSecurityDefinition (): ?array
169163 {
170164 if (empty ($ this ->security )) {
@@ -672,11 +666,17 @@ public function saveConsume()
672666
673667 public function saveTags ()
674668 {
675- $ tagIndex = 1 ;
669+ $ globalPrefix = config ('auto-doc.global_prefix ' );
670+ $ globalPrefix = Str::after ($ globalPrefix , '/ ' );
676671
677672 $ explodedUri = explode ('/ ' , $ this ->uri );
673+ $ explodedUri = array_filter ($ explodedUri );
674+
675+ $ tag = array_shift ($ explodedUri );
678676
679- $ tag = Arr::get ($ explodedUri , $ tagIndex );
677+ if ($ globalPrefix === $ tag ) {
678+ $ tag = array_shift ($ explodedUri );
679+ }
680680
681681 $ this ->item ['tags ' ] = [$ tag ];
682682 }
0 commit comments