Skip to content

Commit 0a908ef

Browse files
committed
Merge pull request laravel#1014 from jasonlewis/feature/root-bundles
Allow bundles to respond to root requests.
2 parents 8e8ef86 + f408fcc commit 0a908ef

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

laravel/bundle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ public static function handles($uri)
191191

192192
foreach (static::$bundles as $key => $value)
193193
{
194-
if (isset($value['handles']) and starts_with($uri, $value['handles'].'/'))
194+
if (isset($value['handles']) and starts_with($uri, $value['handles'].'/') or $value['handles'] == '/')
195195
{
196196
return $key;
197197
}

laravel/routing/router.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,12 @@ public static function register($method, $route, $action)
206206
continue;
207207
}
208208

209-
$uri = str_replace('(:bundle)', static::$bundle, $uri);
209+
$uri = ltrim(str_replace('(:bundle)', static::$bundle, $uri), '/');
210+
211+
if($uri == '')
212+
{
213+
$uri = '/';
214+
}
210215

211216
// If the URI begins with a wildcard, we want to add this route to the
212217
// array of "fallback" routes. Fallback routes are always processed

0 commit comments

Comments
 (0)