File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -705,13 +705,23 @@ protected function runRouteWithinStack(Route $route, Request $request)
705
705
*/
706
706
public function gatherRouteMiddleware (Route $ route )
707
707
{
708
- $ computedMiddleware = $ route ->gatherMiddleware ();
708
+ return $ this ->resolveMiddleware ($ route ->gatherMiddleware (), $ route ->excludedMiddleware ());
709
+ }
709
710
710
- $ excluded = collect ($ route ->excludedMiddleware ())->map (function ($ name ) {
711
+ /**
712
+ * Resolve a flat array of middleware classes from the provided array.
713
+ *
714
+ * @param array $middleware
715
+ * @param array $excluded
716
+ * @return array
717
+ */
718
+ public function resolveMiddleware (array $ middleware , array $ excluded = [])
719
+ {
720
+ $ excluded = collect ($ excluded )->map (function ($ name ) {
711
721
return (array ) MiddlewareNameResolver::resolve ($ name , $ this ->middleware , $ this ->middlewareGroups );
712
722
})->flatten ()->values ()->all ();
713
723
714
- $ middleware = collect ($ computedMiddleware )->map (function ($ name ) {
724
+ $ middleware = collect ($ middleware )->map (function ($ name ) {
715
725
return (array ) MiddlewareNameResolver::resolve ($ name , $ this ->middleware , $ this ->middlewareGroups );
716
726
})->flatten ()->reject (function ($ name ) use ($ excluded ) {
717
727
if (empty ($ excluded )) {
You can’t perform that action at this time.
0 commit comments