예제 #1
0
 /**
  * Get all of the pattern filters matching the route.
  *
  * @param  \Nova\Routing\Route  $route
  * @return array
  */
 protected function getPatternFilters($route)
 {
     $patterns = array();
     foreach ($route->methods() as $method) {
         // For each method supported by the route we will need to gather up the patterned
         // filters for that method. We will then merge these in with the other filters
         // we have already gathered up then return them back out to these consumers.
         $inner = $this->getMethodPatterns($route->uri(), $method);
         $patterns = array_merge($patterns, array_keys($inner));
     }
     return $patterns;
 }
예제 #2
0
 /**
  * Get the URL for a given route instance.
  *
  * @param  \Nova\Routing\Route  $route
  * @param  array  $parameters
  * @param  bool  $absolute
  * @return string
  *
  * @throws \BadMethodCallException
  */
 protected function toRoute($route, array $parameters, $absolute)
 {
     $pattern = $route->uri();
     if ($this->legacyRouting && preg_match('#\\(:\\w+\\)#', $pattern) === 1) {
         list($pattern) = RouteParser::parse($pattern);
     }
     $domain = $this->getRouteDomain($route, $parameters);
     $uri = strtr(rawurlencode($this->trimUrl($root = $this->replaceRoot($route, $domain, $parameters), $this->replaceRouteParameters($pattern, $parameters))), $this->dontEncode) . $this->getRouteQueryString($parameters);
     return $absolute ? $uri : '/' . ltrim(str_replace($root, '', $uri), '/');
 }