Commit 8f8c5f6d authored by Taylor Otwell's avatar Taylor Otwell

fix bug in route loader that caused exception to be thrown when 404 should have been shown.

parent 150fa6a3
...@@ -18,16 +18,16 @@ class Loader { ...@@ -18,16 +18,16 @@ class Loader {
return require APP_PATH.'routes'.EXT; return require APP_PATH.'routes'.EXT;
} }
// --------------------------------------------------------------
// If the request is to the root, load the "home" routes file.
// --------------------------------------------------------------
if ($uri == '/')
{
if ( ! file_exists(APP_PATH.'routes/home'.EXT)) if ( ! file_exists(APP_PATH.'routes/home'.EXT))
{ {
throw new \Exception("A [home] route file is required when using a route directory."); throw new \Exception("A [home] route file is required when using a route directory.");
} }
// --------------------------------------------------------------
// If the request is to the root, load the "home" routes file.
// --------------------------------------------------------------
if ($uri == '/')
{
return require APP_PATH.'routes/home'.EXT; return require APP_PATH.'routes/home'.EXT;
} }
// -------------------------------------------------------------- // --------------------------------------------------------------
...@@ -39,7 +39,7 @@ class Loader { ...@@ -39,7 +39,7 @@ class Loader {
if ( ! file_exists(APP_PATH.'routes/'.$segments[0].EXT)) if ( ! file_exists(APP_PATH.'routes/'.$segments[0].EXT))
{ {
throw new \Exception("No route file defined for routes beginning with [".$segments[0]."]"); return require APP_PATH.'routes/home'.EXT;
} }
return array_merge(require APP_PATH.'routes/'.$segments[0].EXT, require APP_PATH.'routes/home'.EXT); return array_merge(require APP_PATH.'routes/'.$segments[0].EXT, require APP_PATH.'routes/home'.EXT);
......
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