Add controller and controller_action to route.
This commit is contained in:
parent
641f1d4c14
commit
21a51b7cf9
|
@ -154,13 +154,19 @@ public static function call($destination, $parameters = array())
|
||||||
// improve speed since the bundle is not loaded on every request.
|
// improve speed since the bundle is not loaded on every request.
|
||||||
Bundle::start($bundle);
|
Bundle::start($bundle);
|
||||||
|
|
||||||
list($controller_name, $method) = explode('@', $destination);
|
list($name, $method) = explode('@', $destination);
|
||||||
|
|
||||||
$controller = static::resolve($bundle, $controller_name);
|
$controller = static::resolve($bundle, $name);
|
||||||
|
|
||||||
$controller->bundle = $bundle;
|
// For convenience we will set the current controller and action on the
|
||||||
$controller->name = $controller_name;
|
// Request's route instance so they can be easily accessed from the
|
||||||
$controller->action = $method;
|
// application. This is sometimes useful for dynamic situations.
|
||||||
|
if ( ! is_null($route = Request::route()))
|
||||||
|
{
|
||||||
|
$route->controller = $name;
|
||||||
|
|
||||||
|
$route->controller_action = $method;
|
||||||
|
}
|
||||||
|
|
||||||
// If the controller could not be resolved, we're out of options and
|
// If the controller could not be resolved, we're out of options and
|
||||||
// will return the 404 error response. If we found the controller,
|
// will return the 404 error response. If we found the controller,
|
||||||
|
|
|
@ -30,6 +30,20 @@ class Route {
|
||||||
*/
|
*/
|
||||||
public $bundle;
|
public $bundle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the controller used by the route.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $controller;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the controller action used by the route.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $controller_action;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The action that is assigned to the route.
|
* The action that is assigned to the route.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue