diff --git a/Controller.php b/Controller.php index eb62e1e..7fb77f7 100644 --- a/Controller.php +++ b/Controller.php @@ -183,19 +183,24 @@ public function loadRoutes($slim) { $action = strtolower(substr($methodName, 6)); $httpMethod = \Slim\Http\Request::METHOD_DELETE; } - + if (!empty($action)) { - $slim->map("/{$this->base}/{$action}", - array($this, 'preMiddleware'), - array($this, '_runControllerMiddlewares'), - array($this, 'preCallable'), - array($this, $methodName))->via($httpMethod); - $slim->map("/{$this->base}/{$action}(/:param+)", - array($this, 'preMiddleware'), - array($this, '_runControllerMiddlewares'), - array($this, 'preCallable'), - array($this, $methodName))->via($httpMethod); + $action = "/{$action}"; + } + else { + $action = ""; } + + $slim->map("/{$this->base}{$action}", + array($this, 'preMiddleware'), + array($this, '_runControllerMiddlewares'), + array($this, 'preCallable'), + array($this, $methodName))->via($httpMethod); + $slim->map("/{$this->base}{$action}(/:param+)", + array($this, 'preMiddleware'), + array($this, '_runControllerMiddlewares'), + array($this, 'preCallable'), + array($this, $methodName))->via($httpMethod); } }