diff --git a/src/Illuminate/Routing/UrlGenerator.php b/src/Illuminate/Routing/UrlGenerator.php index 595bb6124fcb..a6b827858123 100755 --- a/src/Illuminate/Routing/UrlGenerator.php +++ b/src/Illuminate/Routing/UrlGenerator.php @@ -94,6 +94,23 @@ public function current() return $this->to($this->request->getPathInfo()); } + /** + * Get the current URL with one or more replaced parameters + * + * @param array $routeParameters + * @param array $getParameters + * @param bool $absolute + * @return string + */ + public function alter(array $routeParameters = array(), array $getParameters = array(), $absolute = true) + { + $replacedRouteParameters = $routeParameters + $this->request->route()->parameters(); + $replacedGetParameters = $getParameters + $this->request->query->all(); + + return $this->toRoute($this->request->route(), $replacedRouteParameters, $absolute) + . $this->getRouteQueryString($replacedGetParameters); + } + /** * Get the URL for the previous request. *