[Routing] Route collection prefixes must start with a / and must not end with a /
This commit is contained in:
parent
b80bb9c7ab
commit
98e70f0963
@ -120,10 +120,18 @@ class RouteCollection implements \IteratorAggregate
|
|||||||
*/
|
*/
|
||||||
public function addPrefix($prefix)
|
public function addPrefix($prefix)
|
||||||
{
|
{
|
||||||
|
// a prefix must not end with a slash
|
||||||
|
$prefix = rtrim($prefix, '/');
|
||||||
|
|
||||||
if (!$prefix) {
|
if (!$prefix) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// a prefix must start with a slash
|
||||||
|
if ('/' !== $prefix[0]) {
|
||||||
|
$prefix = '/'.$prefix;
|
||||||
|
}
|
||||||
|
|
||||||
$this->prefix = $prefix.$this->prefix;
|
$this->prefix = $prefix.$this->prefix;
|
||||||
|
|
||||||
foreach ($this->all() as $route) {
|
foreach ($this->all() as $route) {
|
||||||
|
Reference in New Issue
Block a user