Skip to content

Commit 67c5652

Browse files
committed
cleaning up.
1 parent 6191b81 commit 67c5652

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/Illuminate/Routing/Router.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,9 +529,9 @@ protected function createRoute($method, $pattern, $action)
529529

530530
if (isset($action['prefix']))
531531
{
532-
$pattern = trim($action['prefix'], '/').'/'.ltrim($pattern, '/');
532+
$prefix = $action['prefix'];
533533

534-
$pattern = trim($pattern, '/');
534+
$pattern = $this->addPrefix($pattern, $prefix);
535535
}
536536

537537
// We will create the routes, setting the Closure callbacks on the instance
@@ -580,6 +580,20 @@ protected function parseAction($action)
580580
throw new \InvalidArgumentException("Unroutable action.");
581581
}
582582

583+
/**
584+
* Add the given prefix to the given URI pattern.
585+
*
586+
* @param string $pattern
587+
* @param string $prefix
588+
* @return string
589+
*/
590+
protected function addPrefix($pattern, $prefix)
591+
{
592+
$pattern = trim($prefix, '/').'/'.ltrim($pattern, '/');
593+
594+
return trim($pattern, '/');
595+
}
596+
583597
/**
584598
* Set the attributes and requirements on the route.
585599
*

0 commit comments

Comments
 (0)