added route::share method.
This commit is contained in:
@@ -332,6 +332,18 @@ class Route {
|
|||||||
Router::group($attributes, $callback);
|
Router::group($attributes, $callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.
|
* Register a HTTPS route with the router.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -100,6 +100,26 @@ class Router {
|
|||||||
static::register($method, $route, $action);
|
static::register($method, $route, $action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.
|
* Register a group of routes that share attributes.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user