From cb2eb7963b29aafe63c87e1d2b1e633ecd0c25b0 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Fri, 7 Oct 2016 16:50:33 -0500 Subject: [PATCH] use a collection --- .../Foundation/Console/RouteListCommand.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/Illuminate/Foundation/Console/RouteListCommand.php b/src/Illuminate/Foundation/Console/RouteListCommand.php index a0ae2f479183..1f49527eb440 100644 --- a/src/Illuminate/Foundation/Console/RouteListCommand.php +++ b/src/Illuminate/Foundation/Console/RouteListCommand.php @@ -138,15 +138,9 @@ protected function displayRoutes(array $routes) */ protected function getMiddleware($route) { - $middlewares = $route->gatherMiddleware(); - - foreach ($middlewares as $i => $middleware) { - if ($middleware instanceof Closure) { - $middlewares[$i] = 'Closure'; - } - } - - return implode(',', $middlewares); + return collect($route->gatherMiddleware())->map(function ($middleware) { + return $middleware instanceof Closure ? 'Closure' : $middleware; + })->implode(','); } /**