Skip to content

Commit

Permalink
Ajuste para subgrupos
Browse files Browse the repository at this point in the history
Ajuste para subgrupos
  • Loading branch information
toninho09 committed Apr 16, 2017
1 parent 6435d08 commit 0ca3138
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Molecular/Routes/RouteDispacher.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public function custom($method, $name, $function, $params = [])
*/
private function fixPrefix($prefix)
{
if (substr($this->prefix, -1) != '/' && $prefix{0} != '/') {
if ($prefix != '' && substr($this->prefix, -1) != '/' && $prefix{0} != '/') {
$prefix = '/' . $prefix;
}
return $prefix;
Expand All @@ -199,7 +199,7 @@ public function setPrefix($prefix)
public function group($nameGroup, $callback, $params = [])
{
$dispacher = new RouteDispacher();
$dispacher->setPrefix($this->fixPrefix($nameGroup));
$dispacher->setPrefix( $this->prefix . $this->fixPrefix($nameGroup));
$callback($dispacher);
$routes = $dispacher->getRoutes();
foreach ($routes as $keyRoute => $valueRoute) {
Expand Down Expand Up @@ -302,4 +302,4 @@ private function registerRoute($method, $name, $function, $params = [])
if (isset($params['next'])) $route->setNext();
$this->routes[] = $route;
}
}
}

0 comments on commit 0ca3138

Please sign in to comment.