Commit 344f49e1 by Taylor Otwell

made router routes optional and fixed front controller.

parent 3f6aa544
...@@ -145,9 +145,7 @@ $response = System\Routing\Filter::call('before', array(), true); ...@@ -145,9 +145,7 @@ $response = System\Routing\Filter::call('before', array(), true);
// ---------------------------------------------------------- // ----------------------------------------------------------
if (is_null($response)) if (is_null($response))
{ {
list($method, $uri) = array(System\Request::method(), System\Request::uri()); $route = System\Routing\Router::make(Request::method(), Request::uri())->route();
$route = System\Routing\Router::make($method, $uri, System\Routing\Loader::load($uri))->route();
$response = (is_null($route)) ? System\Response::make(System\View::make('error/404'), 404) : $route->call(); $response = (is_null($route)) ? System\Response::make(System\View::make('error/404'), 404) : $route->call();
} }
......
...@@ -26,12 +26,13 @@ class Router { ...@@ -26,12 +26,13 @@ class Router {
* @param array $routes * @param array $routes
* @return void * @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 // Put the request method and URI in route form. Routes begin with
// the request method and a forward slash. // the request method and a forward slash.
$this->request = $method.' /'.trim($uri, '/'); $this->request = $method.' /'.trim($uri, '/');
$this->routes = $routes;
$this->routes = (is_null($routes)) ? Loader::load($uri) : $routes;
} }
/** /**
......
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