Skip to content

Commit

Permalink
Load group routes in a separate method (#16792)
Browse files Browse the repository at this point in the history
...so as not to bleed the $attributes into the routes file.
  • Loading branch information
JosephSilber authored and taylorotwell committed Dec 14, 2016
1 parent e238299 commit 800012d
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/Illuminate/Routing/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,15 +330,26 @@ public function group(array $attributes, $routes)
// Once we have updated the group stack, we'll load the provided routes and
// merge in the group's attributes when the routes are created. After we
// have created the routes, we will pop the attributes off the stack.
$this->loadRoutes($routes);

array_pop($this->groupStack);
}

/**
* Load the provided routes.
*
* @param \Closure|string $routes
* @return void
*/
protected function loadRoutes($routes)
{
if ($routes instanceof Closure) {
$routes($this);
} else {
$router = $this;

require $routes;
}

array_pop($this->groupStack);
}

/**
Expand Down

0 comments on commit 800012d

Please sign in to comment.