Commit d29a1279 authored by Taylor Otwell's avatar Taylor Otwell

allow multiple request methods for uri.

parent f624a684
...@@ -39,7 +39,13 @@ class Router { ...@@ -39,7 +39,13 @@ class Router {
* *
* @var array * @var array
*/ */
public static $fallback = array(); public static $fallback = array(
'GET' => array(),
'POST' => array(),
'PUT' => array(),
'DELETE' => array(),
'HEAD' => array(),
);
/** /**
* The current attributes being shared by routes. * The current attributes being shared by routes.
...@@ -87,7 +93,7 @@ class Router { ...@@ -87,7 +93,7 @@ class Router {
* *
* @var array * @var array
*/ */
public static $methods = array('GET', 'POST', 'PUT', 'DELETE'); public static $methods = array('GET', 'POST', 'PUT', 'DELETE', 'HEAD');
/** /**
* Register a HTTPS route with the router. * Register a HTTPS route with the router.
...@@ -168,6 +174,19 @@ class Router { ...@@ -168,6 +174,19 @@ class Router {
{ {
if (is_string($route)) $route = explode(', ', $route); if (is_string($route)) $route = explode(', ', $route);
// If the developer is registering multiple request methods to handle
// the URI, we'll spin through each method and register the route
// for each of them along with each URI.
if (is_array($method))
{
foreach ($method as $http)
{
static::register($http, $route, $action);
}
return;
}
foreach ((array) $route as $uri) foreach ((array) $route as $uri)
{ {
// If the URI begins with a splat, we'll call the universal method, which // If the URI begins with a splat, we'll call the universal method, which
......
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