|
|
@@ -587,7 +587,7 @@ class RouteBuilder
|
|
|
* This method creates a scoped route collection that includes
|
|
|
* relevant prefix information.
|
|
|
*
|
|
|
- * The path parameter is used to generate the routing parameter name.
|
|
|
+ * The $name parameter is used to generate the routing parameter name.
|
|
|
* For example a path of `admin` would result in `'prefix' => 'admin'` being
|
|
|
* applied to all connected routes.
|
|
|
*
|
|
|
@@ -595,6 +595,17 @@ class RouteBuilder
|
|
|
* Nested prefixes will result in prefix values like `admin/api` which translates
|
|
|
* to the `Controller\Admin\Api\` namespace.
|
|
|
*
|
|
|
+ * If you need to have prefix with dots, eg: '/api/v1.0', use 'path' key
|
|
|
+ * for $params argument:
|
|
|
+ *
|
|
|
+ * ```
|
|
|
+ * $route->prefix('api', function($route) {
|
|
|
+ * $route->prefix('v10', ['path' => '/v1.0'], function($route) {
|
|
|
+ * // Translates to `Controller\Api\V10\` namespace
|
|
|
+ * });
|
|
|
+ * });
|
|
|
+ * ```
|
|
|
+ *
|
|
|
* @param string $name The prefix name to use.
|
|
|
* @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.
|
|
|
@@ -613,6 +624,10 @@ class RouteBuilder
|
|
|
}
|
|
|
$name = Inflector::underscore($name);
|
|
|
$path = '/' . $name;
|
|
|
+ if (isset($params['path'])) {
|
|
|
+ $path = $params['path'];
|
|
|
+ unset($params['path']);
|
|
|
+ }
|
|
|
if (isset($this->_params['prefix'])) {
|
|
|
$name = $this->_params['prefix'] . '/' . $name;
|
|
|
}
|