Refactoring Router.
This commit is contained in:
parent
654c4aa85f
commit
b5e0eb022c
|
|
@ -23,7 +23,7 @@ public static function route($method, $uri)
|
||||||
|
|
||||||
if (is_null(static::$routes))
|
if (is_null(static::$routes))
|
||||||
{
|
{
|
||||||
static::$routes = static::load($uri);
|
static::$routes = ( ! is_dir(APP_PATH.'routes')) ? require APP_PATH.'routes'.EXT : static::load($uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is there an exact match for the request?
|
// Is there an exact match for the request?
|
||||||
|
|
@ -65,11 +65,6 @@ public static function route($method, $uri)
|
||||||
*/
|
*/
|
||||||
public static function load($uri)
|
public static function load($uri)
|
||||||
{
|
{
|
||||||
if ( ! is_dir(APP_PATH.'routes'))
|
|
||||||
{
|
|
||||||
return require APP_PATH.'routes'.EXT;
|
|
||||||
}
|
|
||||||
|
|
||||||
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.");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue