Skip to content
Permalink
Browse files

Adding $params argument to prefix() method of RouteBuilder.

  • Loading branch information...
andretefras committed Oct 20, 2016
1 parent aca66f9 commit 929758787e3016147ded8ee4f53cfeb36cc81bb7
Showing with 9 additions and 3 deletions.
  1. +9 −3 src/Routing/RouteBuilder.php
@@ -596,17 +596,23 @@ public function redirect($route, $url, array $options = [])
* to the `Controller\Admin\Api\` namespace.
*
* @param string $name The prefix name to use.
* @param callable $callback The callback to invoke that builds the prefixed routes.
* @param array|callable $params An array of routing defaults to add to each connected route.
* If you have no parameters, this argument can be a callable.
* @param callable|null $callback The callback to invoke that builds the prefixed routes.
* @return void
*/
public function prefix($name, callable $callback)
public function prefix($name, $params = [], callable $callback = null)
{
if ($callback === null) {
$callback = $params;
$params = [];
}
$name = Inflector::underscore($name);
$path = '/' . $name;
if (isset($this->_params['prefix'])) {
$name = $this->_params['prefix'] . '/' . $name;
}
$params = ['prefix' => $name];
$params = array_merge($params, ['prefix' => $name]);
$this->scope($path, $params, $callback);
}

0 comments on commit 9297587

Please sign in to comment.
You can’t perform that action at this time.