@@ -90,6 +90,8 @@ public function get(): array
9090
9191 foreach ($ routes as $ item ) {
9292 $ route = $ item ['route ' ] . $ item ['route_params ' ];
93+
94+ // For module routing
9395 if ($ this ->prefix !== '' && $ route === '/ ' ) {
9496 $ route = $ this ->prefix ;
9597 } elseif ($ this ->prefix !== '' ) {
@@ -115,13 +117,22 @@ private function addFilters($routes)
115117 $ filterCollector = new FilterCollector (true );
116118
117119 foreach ($ routes as &$ route ) {
120+ $ routePath = $ route ['route ' ];
121+
122+ // For module routing
123+ if ($ this ->prefix !== '' && $ route === '/ ' ) {
124+ $ routePath = $ this ->prefix ;
125+ } elseif ($ this ->prefix !== '' ) {
126+ $ routePath = $ this ->prefix . '/ ' . $ routePath ;
127+ }
128+
118129 // Search filters for the URI with all params
119130 $ sampleUri = $ this ->generateSampleUri ($ route );
120- $ filtersLongest = $ filterCollector ->get ($ route ['method ' ], $ route [ ' route ' ] . $ sampleUri );
131+ $ filtersLongest = $ filterCollector ->get ($ route ['method ' ], $ routePath . $ sampleUri );
121132
122133 // Search filters for the URI without optional params
123134 $ sampleUri = $ this ->generateSampleUri ($ route , false );
124- $ filtersShortest = $ filterCollector ->get ($ route ['method ' ], $ route [ ' route ' ] . $ sampleUri );
135+ $ filtersShortest = $ filterCollector ->get ($ route ['method ' ], $ routePath . $ sampleUri );
125136
126137 // Get common array elements
127138 $ filters ['before ' ] = array_intersect ($ filtersLongest ['before ' ], $ filtersShortest ['before ' ]);
0 commit comments