From f408fcc26b20e31308bf9f90617ade33c1596102 Mon Sep 17 00:00:00 2001 From: Jason Lewis Date: Fri, 27 Jul 2012 12:30:41 +0930 Subject: [PATCH] Allow bundles to respond to root requests. Signed-off-by: Jason Lewis --- laravel/bundle.php | 2 +- laravel/routing/router.php | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/laravel/bundle.php b/laravel/bundle.php index 2259228e..2220322b 100644 --- a/laravel/bundle.php +++ b/laravel/bundle.php @@ -191,7 +191,7 @@ public static function handles($uri) 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; } diff --git a/laravel/routing/router.php b/laravel/routing/router.php index 00659a22..cae6ff30 100644 --- a/laravel/routing/router.php +++ b/laravel/routing/router.php @@ -206,7 +206,12 @@ public static function register($method, $route, $action) 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 // array of "fallback" routes. Fallback routes are always processed