File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 88use Illuminate \Http \Request ;
99use Illuminate \Container \Container ;
1010use Dingo \Api \Contract \Routing \Adapter ;
11+ use Laravel \Lumen \Routing \Controller as LumenController ;
1112
1213class Route
1314{
@@ -194,7 +195,15 @@ protected function mergeControllerProperties()
194195
195196 $ controller = $ this ->getControllerInstance ();
196197
197- $ this ->middleware = array_merge ($ this ->middleware , $ controller ->getMiddleware ());
198+ $ controllerMiddleware = [];
199+
200+ if (method_exists ($ controller , 'getMiddleware ' )) {
201+ $ controllerMiddleware = $ controller ->getMiddleware ();
202+ } elseif (method_exists ($ controller , 'getMiddlewareForMethod ' )) {
203+ $ controllerMiddleware = $ controller ->getMiddlewareForMethod ($ this ->controllerMethod );
204+ }
205+
206+ $ this ->middleware = array_merge ($ this ->middleware , $ controllerMiddleware );
198207
199208 if ($ property = $ this ->findControllerPropertyOptions ('throttles ' )) {
200209 $ this ->throttle = $ property ['class ' ];
You can’t perform that action at this time.
0 commit comments