Browse Source

Merge pull request #1014 from jasonlewis/feature/root-bundles

Allow bundles to respond to root requests.
Taylor Otwell 12 years ago
parent
commit
0a908eff8d
2 changed files with 7 additions and 2 deletions
  1. 1 1
      laravel/bundle.php
  2. 6 1
      laravel/routing/router.php

+ 1 - 1
laravel/bundle.php

@@ -191,7 +191,7 @@ class Bundle {
 
 		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;
 			}

+ 6 - 1
laravel/routing/router.php

@@ -206,7 +206,12 @@ class Router {
 				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