Commit 3d1a4402 by Taylor Otwell

added route::share method.

parent 0f2d3117
......@@ -333,6 +333,18 @@ class Route {
}
/**
* Register many request URIs to a single action.
*
* @param array $routes
* @param mixed $action
* @return void
*/
public static function share($routes, $action)
{
Router::share($routes, $action);
}
/**
* Register a HTTPS route with the router.
*
* @param string $method
......
......@@ -101,6 +101,26 @@ class Router {
}
/**
* Register many request URIs to a single action.
*
* <code>
* // Register a group of URIs for an action
* Router::share(array('GET', '/'), array('POST', '/'), 'home@index');
* </code>
*
* @param array $routes
* @param mixed $action
* @return void
*/
public static function share($routes, $action)
{
foreach ($routes as $route)
{
static::register($route[0], $route[1], $action);
}
}
/**
* Register a group of routes that share attributes.
*
* @param array $attributes
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment