Skip to content

Commit

Permalink
fixing a few things. cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jun 22, 2016
1 parent 0f1e407 commit cc60121
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 62 deletions.
2 changes: 0 additions & 2 deletions src/Illuminate/Foundation/Console/RouteListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,6 @@ protected function getMiddleware($route)
*/
protected function getControllerMiddleware($actionName)
{
Controller::setRouter($this->laravel['router']);

$segments = explode('@', $actionName);

return $this->getControllerMiddlewareFromInstance(
Expand Down
28 changes: 0 additions & 28 deletions src/Illuminate/Routing/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@ abstract class Controller
*/
protected $middleware = [];

/**
* The router instance.
*
* @var \Illuminate\Routing\Router
*/
protected static $router;

/**
* Register middleware on the controller.
*
Expand All @@ -47,27 +40,6 @@ public function getMiddleware()
return $this->middleware;
}

/**
* Get the router instance.
*
* @return \Illuminate\Routing\Router
*/
public static function getRouter()
{
return static::$router;
}

/**
* Set the router instance.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public static function setRouter(Router $router)
{
static::$router = $router;
}

/**
* Execute an action on the controller.
*
Expand Down
26 changes: 3 additions & 23 deletions src/Illuminate/Routing/ControllerDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,6 @@ class ControllerDispatcher
{
use RouteDependencyResolverTrait;

/**
* The router instance.
*
* @var \Illuminate\Routing\Router
*/
protected $router;

/**
* Create a new controller dispatcher instance.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function __construct(Router $router)
{
$this->router = $router;
}

/**
* Dispatch a request to a given controller and method.
*
Expand All @@ -34,20 +16,18 @@ public function __construct(Router $router)
*/
public function dispatch(Route $route, $controller, $method)
{
Controller::setRouter($this->router);

return $this->call($controller, $route, $method);
return $this->call($route, $controller, $method);
}

/**
* Call the given controller instance method.
*
* @param \Illuminate\Routing\Controller $controller
* @param \Illuminate\Routing\Route $route
* @param \Illuminate\Routing\Controller $controller
* @param string $method
* @return mixed
*/
protected function call($controller, $route, $method)
protected function call($route, $controller, $method)
{
$parameters = $this->resolveClassMethodDependencies(
$route->parametersWithoutNulls(), $controller, $method
Expand Down
20 changes: 11 additions & 9 deletions src/Illuminate/Routing/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ class Route
*/
protected $action;

/**
* The controller instance.
*
* @var mixed
*/
protected $controller;

/**
* The default values for the route.
*
Expand Down Expand Up @@ -85,13 +92,6 @@ class Route
*/
protected $router;

/**
* The controller instance.
*
* @var mixed
*/
protected $controller;

/**
* The container instance used by the route.
*
Expand Down Expand Up @@ -183,7 +183,7 @@ protected function runCallable()
*/
protected function runController()
{
return (new ControllerDispatcher($this->router))->dispatch(
return (new ControllerDispatcher)->dispatch(
$this, $this->getController(), $this->getControllerMethod()
);
}
Expand Down Expand Up @@ -310,7 +310,9 @@ public function controllerMiddleware()
return [];
}

return ControllerDispatcher::getMiddleware($this->getController(), $this->getControllerMethod());
return ControllerDispatcher::getMiddleware(
$this->getController(), $this->getControllerMethod()
);
}

/**
Expand Down

0 comments on commit cc60121

Please sign in to comment.