/** * Get the URL to a named route. * * @param string $name * @param mixed $parameters * @param bool $absolute * @return string */ public function route($name, $parameters = [], $absolute = true) { if ($this->isCurrentLocaleDefault()) { return $this->url->route($name, $parameters, $absolute); } $name = $this->config->get('app.locale') . '.' . $name; return $this->url->route($name, $parameters, $absolute); }
/** * Get the action for a "route" option. * * @param array|string $options * * @return string */ protected function getRouteAction($options) { if (is_array($options)) { return $this->url->route($options[0], array_slice($options, 1)); } return $this->url->route($options); }
/** * Generates the menu item URL, using any of the following options, in order: * * If you pass a 'full_url' key within the item configuration, in that case * it will return it as the URL with no additional action. * * If you pass a 'url' key then it will call the Url::to method to complete * the base URL, you can also specify a 'secure' key to indicate whether * this URL should be secure or not. Otherwise the defaultSecure option will * be used. * * If you pass a 'route' key then it will call the getRouteAndParameters to * return the route's name and its parameters, then it will call Url::route * * If you pass an 'action' key it'd be processed in a similar way as the * route key, but calling the Url::action method instead. * * If none of these options are found then this function will simple return * a placeholder (#). * * * @param $values * @return mixed */ protected function generateUrl($values) { if (isset($values['full_url'])) { return $values['full_url']; } if (isset($values['url'])) { $isSecure = isset($values['secure']) ? $values['secure'] : $this->defaultSecure; return $this->url->to($values['url'], $isSecure); } if (isset($values['route'])) { list($route, $params) = $this->getRouteAndParameters($values['route']); return $this->url->route($route, $params); } if (isset($values['action'])) { list($route, $params) = $this->getRouteAndParameters($values['action']); return $this->url->action($route, $params); } return '#'; }
/** * Generate a HTML link to a named route. * * @param string $name * @param string $title * @param array $parameters * @param array $attributes * * @return string */ public function linkRoute($name, $title = null, $parameters = [], $attributes = []) { return $this->link($this->url->route($name, $parameters), $title, $attributes); }
/** * Normalize route to url * * @param string $url * @return string */ protected function normalize($url) { return $this->route->has($url) ? $this->url->route($url) : $url; }
/** * {@inheritdoc} */ public function route($routeName, array $parameters = [], $absolute = true) { return $this->urlGenerator->route($routeName, $parameters, $absolute); }
/** * {@inheritdoc} */ public function route($name, $parameters = [], $absolute = true) { $permission = $this->securityApi->permissions()->getForRoute($name); $this->checkPermission($permission); return $this->url->route($name, $parameters, $absolute); }
/** * @param Viewable $viewable * * @throws \InvalidArgumentException * * @return string */ public function viewHrefFor(Viewable $viewable) : string { return $this->urlGenerator->route($viewable->routePrefix() . self::ROUTE_VIEW, $viewable->locationParts()); }
/** * get route src * * @param File $file file instance * @return string */ public function route(File $file) { return $this->urlGenerator->route($this->routeName, ['id' => $file->id]); }
/** * Get a JSON API link to a named route within your application. * * @param $name * @param array $parameters * @param array|object|null * meta to attach to the link object. * @return LinkInterface */ public function route($name, $parameters = [], $meta = null) { $uri = $this->generator->route($name, $parameters); return new Link($uri, $meta, true); }
protected function getUrlToPath($path) { return $this->generator->route('fluxbb', ['url' => $path]); }
/** * Generate route via illuminate * * @param $name * @param array $parameters * @param bool $absolute * @return string */ private function resolveRoute($name, $parameters = [], $absolute = true) { return $this->generator->route($name, $parameters, $absolute); }
/** * Get the action for a "route" option. * * @param array|string $options * * @return string */ private function getRouteAction($options) { return is_array($options) ? $this->url->route($options[0], array_slice($options, 1)) : $this->url->route($options); }
/** * Generate a HTML link to a named route. * * @param string $name * @param string $title * @param array $parameters * @param array $attributes * @param bool $escaped * * @return \Illuminate\Support\HtmlString */ public function linkRoute($name, $title = null, $parameters = [], $attributes = [], $escaped = true) { $url = $this->url->route($name, $parameters); return $this->link($url, $title, $attributes, null, $escaped); }
/** * generateUrl. * * @method generateUrl * * @param string $path * @param array $parameters * * @return string */ protected function generateUrl($path, array $parameters = []) { return $this->urlGenerator->route($path, $parameters); }
/** * Get static option data for the editor * * @return array */ protected function getStaticOption() { $routeParam = ['instanceId' => $this->instanceId]; return ['fileUpload' => ['upload_url' => $this->urls->route('editor.file.upload', $routeParam), 'source_url' => $this->urls->route('editor.file.source', $routeParam), 'download_url' => $this->urls->route('editor.file.download', $routeParam), 'destroy_url' => $this->urls->route('editor.file.destroy', $routeParam)], 'suggestion' => ['hashtag_api' => $this->urls->route('editor.hashTag'), 'mention_api' => $this->urls->route('editor.mention')], 'names' => ['file' => ['input' => $this->getFileInputName(), 'class' => $this->getFileClassName(), 'identifier' => $this->getFileIdentifierAttrName(), 'image' => ['class' => $this->getImageClassName(), 'identifier' => $this->getImageIdentifierAttrName()]], 'tag' => ['input' => $this->getTagInputName(), 'class' => $this->getTagClassName()], 'mention' => ['input' => $this->getMentionInputName(), 'class' => $this->getMentionClassName(), 'identifier' => $this->getMentionIdentifierAttrName()]]]; }
function it_passes_prefixed_named_route_to_url_when_locale_is_not_default(Config $config, UrlGenerator $url) { $config->get('app.locale')->willReturn('en'); $url->route('en.home', [], true)->shouldBeCalled(); $this->route('home'); }