当前位置: 首页>>代码示例>>PHP>>正文


PHP UrlGenerator::to方法代码示例

本文整理汇总了PHP中Illuminate\Routing\UrlGenerator::to方法的典型用法代码示例。如果您正苦于以下问题:PHP UrlGenerator::to方法的具体用法?PHP UrlGenerator::to怎么用?PHP UrlGenerator::to使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Routing\UrlGenerator的用法示例。


在下文中一共展示了UrlGenerator::to方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: withBrand

 public function withBrand($brand, $link = null)
 {
     if (!isset($link)) {
         $link = $this->url->to('/');
     }
     $this->brand = compact('brand', 'link');
     return $this;
 }
开发者ID:AdrianSkierniewski,项目名称:bootstrapper,代码行数:8,代码来源:Navbar.php

示例2: getHomeUrl

 protected function getHomeUrl()
 {
     // wrap in value() to allow closures
     $enableHomeLink = value($this->config->get('c::enable-home-link', false));
     if ($enableHomeLink) {
         $url = $this->config->get('c::redirect-login', '/');
         return $this->url->to($url);
     }
     return null;
 }
开发者ID:anlutro,项目名称:l4-core,代码行数:10,代码来源:MenuViewCreator.php

示例3: guess

 /**
  * Guess the HREF for a button.
  *
  * @param TableBuilder $builder
  */
 public function guess(TableBuilder $builder)
 {
     $buttons = $builder->getButtons();
     if (!($section = $this->sections->active())) {
         return;
     }
     if (!($module = $this->modules->active())) {
         return;
     }
     $stream = $builder->getTableStream();
     foreach ($buttons as &$button) {
         // If we already have an HREF then skip it.
         if (isset($button['attributes']['href'])) {
             continue;
         }
         switch (array_get($button, 'button')) {
             case 'restore':
                 $button['attributes']['href'] = $this->url->to('entry/handle/restore/' . $module->getNamespace() . '/' . $stream->getNamespace() . '/' . $stream->getSlug() . '/{entry.id}');
                 break;
             default:
                 // Determine the HREF based on the button type.
                 $type = array_get($button, 'segment', array_get($button, 'button'));
                 if ($type && !str_contains($type, '\\') && !class_exists($type)) {
                     $button['attributes']['href'] = $section->getHref($type . '/{entry.id}');
                 }
                 break;
         }
     }
     $builder->setButtons($buttons);
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:35,代码来源:HrefGuesser.php

示例4: url

 /**
  * Return the URL for the file.
  *
  * @param array $attributes
  * @param null  $secure
  * @return string
  */
 public function url(array $attributes = [], $secure = null)
 {
     if ($secure === null) {
         $secure = $this->request->isSecure();
     }
     return $this->url->to($this->object->publicPath(), $attributes, $secure);
 }
开发者ID:bloveless,项目名称:files-module,代码行数:14,代码来源:FilePresenter.php

示例5: filter

 public function filter(Route $route, Request $request)
 {
     if ($this->auth->check()) {
         $config = $this->config->get('c::redirect-login');
         $url = $config ? $this->url->to($config) : '/';
         return $this->redirect->to($url);
     }
 }
开发者ID:anlutro,项目名称:l4-core,代码行数:8,代码来源:GuestFilter.php

示例6: url

 /**
  * Generates a url for Sorter
  *
  * @param string $field
  * @param null|string $path
  * @param boolean $appends
  * */
 public function url($field, $path = null, $appends = true)
 {
     if ($path === null) {
         $path = $this->url->current();
     }
     $queryString = [$this->getFieldIndex() => $field, $this->getDirectionIndex() => $this->getConditionallyDirection($field)];
     $appends && ($queryString += $this->request->query());
     $url = $path . '?' . http_build_query($queryString);
     return $this->url->to($url);
 }
开发者ID:laravellegends,项目名称:sorter,代码行数:17,代码来源:Sorter.php

示例7: guess

 /**
  * Guess the HREF for the views.
  *
  * @param TableBuilder $builder
  */
 public function guess(TableBuilder $builder)
 {
     $views = $builder->getViews();
     foreach ($views as &$view) {
         // Only automate it if not set.
         if (!isset($view['attributes']['href'])) {
             $view['attributes']['href'] = $this->url->to($this->request->path() . '?' . array_get($view, 'prefix') . 'view=' . $view['slug']);
         }
     }
     $builder->setViews($views);
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:16,代码来源:HrefGuesser.php

示例8:

 function it_creates_image_links(UrlGenerator $url)
 {
     $url->to('/', null)->shouldBeCalled()->willReturn('localhost');
     $this->beConstructedWith($url);
     $html = '<a href="localhost"><img src="http://placehold.it/100x100.png" /></a>';
     $this->linkImage('/', '<img src="http://placehold.it/100x100.png" />')->shouldReturn($html);
 }
开发者ID:nukacode,项目名称:front-end-materialize,代码行数:7,代码来源:HtmlBuilderSpec.php

示例9: url

 public function url($path = null, $parameters = [], $secure = null)
 {
     if (!$path) {
         return $this->url;
     }
     return $this->url->to($path, $parameters, $secure);
 }
开发者ID:rcrowe,项目名称:twigbridge,代码行数:7,代码来源:Url.php

示例10: handle

 /**
  * @param $request
  * @param \Closure $next
  * @return \Illuminate\Http\RedirectResponse
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->check()) {
         return new RedirectResponse(UrlGenerator::to('admin'));
     }
     return $next($request);
 }
开发者ID:darrengopower,项目名称:framework,代码行数:12,代码来源:RedirectIfAuthenticated.php

示例11: to

 /**
  * Generate a absolute URL to the given path.
  *
  * @param  mixed  $path or SiteTreeNodeInterface Instance
  * @param  mixed  $extra
  * @param  bool  $secure
  * @return string
  */
 public function to($path, $extra = array(), $secure = null)
 {
     // Page object passed
     if (is_object($path) && $path instanceof SiteTreeNodeInterface) {
         if (starts_with($path->getPath(), 'http:')) {
             $path = $path->getPath();
         } else {
             $path = $this->getPathFinder()->toPage($path);
         }
     } elseif (is_string($path) && $this->pageTypes->has($path)) {
         $path = $this->getPathFinder()->toPageType($path);
     } elseif (is_string($path) && $this->currentCmsPathProvider->getCurrentCmsPath()->isCmsPath()) {
         if ($extra && !isset($extra[0])) {
             $extra = array_values($extra);
             $extraPath = implode('/', $extra);
             $path = trim($path, '/') . '/' . trim($extraPath, '/');
             $extra = [];
         }
         if ($path == '/' && $this->getTreeScope()) {
             $path = trim($this->getTreeScope()->getPathPrefix() . $path, '/');
         }
     } elseif ($path == '/' && ($treeScope = $this->getTreeScope())) {
         $path = trim($treeScope->getPathPrefix() . $path, '/');
     }
     return parent::to($path, $extra, $secure);
 }
开发者ID:realholgi,项目名称:cmsable,代码行数:34,代码来源:SiteTreeUrlGenerator.php

示例12: getUrlAction

 /**
  * Get the action for a "url" option.
  *
  * @param  array|string  $options
  * @return string
  */
 protected function getUrlAction($options)
 {
     if (is_array($options)) {
         return $this->url->to($options[0], array_slice($options, 1));
     }
     return $this->url->to($options);
 }
开发者ID:GeorgeShazkho,项目名称:micros-de-conce,代码行数:13,代码来源:FormBuilder.php

示例13: guess

 /**
  * Guess the sections HREF attribute.
  *
  * @param ControlPanelBuilder $builder
  */
 public function guess(ControlPanelBuilder $builder)
 {
     $sections = $builder->getSections();
     foreach ($sections as $index => &$section) {
         // If HREF is set then skip it.
         if (isset($section['attributes']['href'])) {
             continue;
         }
         $module = $this->modules->active();
         $href = $this->url->to('admin/' . $module->getSlug());
         if ($index !== 0 && $module->getSlug() !== $section['slug']) {
             $href .= '/' . $section['slug'];
         }
         $section['attributes']['href'] = $href;
     }
     $builder->setSections($sections);
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:22,代码来源:HrefGuesser.php

示例14: link

 /**
  * Generate a HTML link.
  *
  * @param  string  $url
  * @param  string  $title
  * @param  array   $attributes
  * @param  bool    $secure
  * @return string
  */
 public function link($url, $title = null, $attributes = array(), $secure = null)
 {
     $url = $this->url->to($url, array(), $secure);
     if (is_null($title) || $title === false) {
         $title = $url;
     }
     return '<a href="' . $url . '"' . $this->attributes($attributes) . '>' . $this->entities($title) . '</a>';
 }
开发者ID:manhvu1212,项目名称:videoplatform,代码行数:17,代码来源:HtmlBuilder.php

示例15: image

 /**
  * Generate an HTML image element.
  *
  * @param  string $url
  * @param  string $alt
  * @param  array  $attributes
  * @return string
  */
 public function image($url, $alt = null, $attributes = array())
 {
     if (is_null($alt)) {
         $alt = $url;
     }
     $attributes['alt'] = $alt;
     return '<img src="' . $this->url->to($url) . '"' . $this->attributes($attributes) . '>';
 }
开发者ID:laravelbook,项目名称:laravel4-powerpack,代码行数:16,代码来源:HTML.php


注:本文中的Illuminate\Routing\UrlGenerator::to方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。