added better comments to url->to_route method.
This commit is contained in:
parent
096280c958
commit
1463617f13
|
@ -146,11 +146,15 @@ public function to_route($name, $parameters = array(), $https = false)
|
||||||
|
|
||||||
$uri = substr($uris[0], strpos($uris[0], '/'));
|
$uri = substr($uris[0], strpos($uris[0], '/'));
|
||||||
|
|
||||||
|
// Spin through each route parameter and replace the route wildcard segment
|
||||||
|
// with the corresponding parameter passed to the method.
|
||||||
foreach ($parameters as $parameter)
|
foreach ($parameters as $parameter)
|
||||||
{
|
{
|
||||||
$uri = preg_replace('/\(.+?\)/', $parameter, $uri, 1);
|
$uri = preg_replace('/\(.+?\)/', $parameter, $uri, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Before generating the route URL, we will replace all remaining optional
|
||||||
|
// wildcard segments that were not replaced by parameters with spaces.
|
||||||
return $this->to(str_replace(array('/(:any?)', '/(:num?)'), '', $uri), $https);
|
return $this->to(str_replace(array('/(:any?)', '/(:num?)'), '', $uri), $https);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue