File tree 2 files changed +19
-3
lines changed
2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change 72
72
// 'password' => 'changeme',
73
73
],
74
74
75
+ /*
76
+ * Include Middleware.
77
+ *
78
+ * The middleware items you want to include for export.
79
+ */
80
+
81
+ 'include_middleware ' => ['api ' ],
82
+
75
83
];
Original file line number Diff line number Diff line change @@ -54,10 +54,18 @@ public function handle(): void
54
54
55
55
foreach ($ this ->router ->getRoutes () as $ route ) {
56
56
$ methods = collect ($ route ->methods ())->reject (fn ($ method ) => $ method == 'HEAD ' );
57
- $ middleware = $ route ->gatherMiddleware ();
57
+ $ middlewares = $ route ->gatherMiddleware ();
58
58
59
59
foreach ($ methods as $ method ) {
60
- if (empty ($ middleware ) || ! in_array ('api ' , $ middleware )) {
60
+ $ includedMiddleware = false ;
61
+
62
+ foreach ($ middlewares as $ middleware ) {
63
+ if (in_array ($ middleware , $ this ->config ['include_middleware ' ])) {
64
+ $ includedMiddleware = true ;
65
+ }
66
+ }
67
+
68
+ if (empty ($ middlewares ) || ! $ includedMiddleware ) {
61
69
continue ;
62
70
}
63
71
@@ -97,7 +105,7 @@ public function handle(): void
97
105
98
106
$ routeHeaders = $ this ->config ['headers ' ];
99
107
100
- if ($ bearer && in_array ($ this ->config ['auth_middleware ' ], $ middleware )) {
108
+ if ($ bearer && in_array ($ this ->config ['auth_middleware ' ], $ middlewares )) {
101
109
$ routeHeaders [] = [
102
110
'key ' => 'Authorization ' ,
103
111
'value ' => 'Bearer {{token}} ' ,
You can’t perform that action at this time.
0 commit comments