浏览代码

Fixed top-level settings for the Laravel Framework

Andrey Helldar 5 年之前
父节点
当前提交
0d520febf6
共有 4 个文件被更改,包括 28 次插入32 次删除
  1. 24 28
      config/apidoc.php
  2. 2 2
      routes/laravel.php
  3. 1 1
      src/ApiDoc.php
  4. 1 1
      src/ApiDocGeneratorServiceProvider.php

+ 24 - 28
config/apidoc.php

@@ -43,6 +43,30 @@ return [
         'description' => null,
     ],
 
+    /*
+     * Group of settings for managing routes in Laravel Framework.
+     */
+    'laravel' => [
+        /*
+         * Autoload routes for the app.
+         *
+         * Default, false.
+         */
+        'autoload' => false,
+
+        /*
+         * URL prefix of routes for your documentation.
+         *
+         * By default, `/doc` opens the blade, and `/doc.json` returns the Postman collection.
+         */
+        'url_prefix' => '/doc',
+
+        /*
+         * Setting up middleware for Laravel routes.
+         */
+        'middleware' => [],
+    ],
+
     /*
      * The routes for which documentation should be generated.
      * Each group contains rules defining which routes should be included ('match', 'include' and 'exclude' sections)
@@ -50,34 +74,6 @@ return [
      */
     'routes' => [
         [
-            /*
-             * Group of settings for managing routes in Laravel Framework.
-             */
-
-            'laravel' => [
-                /*
-                 * Autoload routes for the app.
-                 *
-                 * Default, false.
-                 */
-
-                'autoload' => false,
-
-                /*
-                 * URL prefix of routes for your documentation.
-                 *
-                 * By default, `/doc` opens the blade, and `/doc.json` returns the Postman collection.
-                 */
-
-                'url_prefix' => '/doc',
-
-                /*
-                 * Setting up middleware for Laravel routes.
-                 */
-
-                'middleware' => [],
-            ],
-
             /*
              * Specify conditions to determine what routes will be parsed in this group.
              * A route must fulfill ALL conditions to pass.

+ 2 - 2
routes/laravel.php

@@ -2,8 +2,8 @@
 
 use Illuminate\Support\Facades\Route;
 
-$prefix = config('apidoc.routes.laravel.url_prefix', '/doc');
-$middleware = config('apidoc.routes.laravel.middleware', []);
+$prefix = config('apidoc.laravel.url_prefix', '/doc');
+$middleware = config('apidoc.laravel.middleware', []);
 
 Route::prefix($prefix)
     ->namespace('\Mpociot\ApiDoc\Http')

+ 1 - 1
src/ApiDoc.php

@@ -31,6 +31,6 @@ class ApiDoc
      */
     protected static function middleware()
     {
-        return config('apidoc.routes.laravel.middleware', []);
+        return config('apidoc.laravel.middleware', []);
     }
 }

+ 1 - 1
src/ApiDocGeneratorServiceProvider.php

@@ -54,7 +54,7 @@ class ApiDocGeneratorServiceProvider extends ServiceProvider
     {
         if (
             config('apidoc.type', 'static') === 'laravel' &&
-            config('apidoc.routes.laravel.autoload', false)
+            config('apidoc.laravel.autoload', false)
         ) {
             $this->loadRoutesFrom(
                 __DIR__.'/../routes/laravel.php'