Skip to content

Commit 74b0636

Browse files
committedApr 1, 2016
formatting
1 parent 9f7720e commit 74b0636

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed
 

‎src/Illuminate/Routing/Route.php

+18-6
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,9 @@ public function middleware($middleware = null)
238238
$middlewares = (array) Arr::get($this->action, 'middleware', []);
239239

240240
if (is_string($this->action['uses'])) {
241-
list($class, $method) = explode('@', $this->action['uses']);
242-
$controller = $this->container->make($class);
243-
244-
$controllerMiddlewares = (new ControllerDispatcher($this->router, $this->container))
245-
->getMiddleware($controller, $method);
246-
$middlewares = array_merge($middlewares, $controllerMiddlewares);
241+
$middlewares = array_merge(
242+
$middlewares, $this->controllerMiddleware()
243+
);
247244
}
248245

249246
return $middlewares;
@@ -260,6 +257,21 @@ public function middleware($middleware = null)
260257
return $this;
261258
}
262259

260+
/**
261+
* Get the controller middleware for the route.
262+
*
263+
* @return array
264+
*/
265+
protected function controllerMiddleware()
266+
{
267+
list($class, $method) = explode('@', $this->action['uses']);
268+
269+
$controller = $this->container->make($class);
270+
271+
return (new ControllerDispatcher($this->router, $this->container))
272+
->getMiddleware($controller, $method);
273+
}
274+
263275
/**
264276
* Get the parameters that are listed in the route / controller signature.
265277
*

0 commit comments

Comments
 (0)
Please sign in to comment.