Allow bundles to respond to root requests.

Signed-off-by: Jason Lewis <jason.lewis1991@gmail.com>
This commit is contained in:
Jason Lewis 2012-07-27 12:30:41 +09:30
parent 5c3ede74d9
commit f408fcc26b
2 changed files with 7 additions and 2 deletions

View File

@ -191,7 +191,7 @@ public static function handles($uri)
foreach (static::$bundles as $key => $value) foreach (static::$bundles as $key => $value)
{ {
if (isset($value['handles']) and starts_with($uri, $value['handles'].'/')) if (isset($value['handles']) and starts_with($uri, $value['handles'].'/') or $value['handles'] == '/')
{ {
return $key; return $key;
} }

View File

@ -206,7 +206,12 @@ public static function register($method, $route, $action)
continue; continue;
} }
$uri = str_replace('(:bundle)', static::$bundle, $uri); $uri = ltrim(str_replace('(:bundle)', static::$bundle, $uri), '/');
if($uri == '')
{
$uri = '/';
}
// If the URI begins with a wildcard, we want to add this route to the // If the URI begins with a wildcard, we want to add this route to the
// array of "fallback" routes. Fallback routes are always processed // array of "fallback" routes. Fallback routes are always processed