made router routes optional and fixed front controller.

This commit is contained in:
Taylor Otwell 2011-07-31 17:40:03 -05:00
parent 3f6aa54487
commit 344f49e1bf
2 changed files with 4 additions and 5 deletions

View File

@ -145,9 +145,7 @@
// ----------------------------------------------------------
if (is_null($response))
{
list($method, $uri) = array(System\Request::method(), System\Request::uri());
$route = System\Routing\Router::make($method, $uri, System\Routing\Loader::load($uri))->route();
$route = System\Routing\Router::make(Request::method(), Request::uri())->route();
$response = (is_null($route)) ? System\Response::make(System\View::make('error/404'), 404) : $route->call();
}

View File

@ -26,12 +26,13 @@ class Router {
* @param array $routes
* @return void
*/
public function __construct($method, $uri, $routes)
public function __construct($method, $uri, $routes = null)
{
// Put the request method and URI in route form. Routes begin with
// the request method and a forward slash.
$this->request = $method.' /'.trim($uri, '/');
$this->routes = $routes;
$this->routes = (is_null($routes)) ? Loader::load($uri) : $routes;
}
/**