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


PHP UrlGenerator::current方法代码示例

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


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

示例1: 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

示例2: calculateFullPath

 /**
  * @param array        $value
  * @param string       $route
  * @param UrlGenerator $router
  *
  * @return mixed|string
  */
 protected function calculateFullPath(array &$value, $route, UrlGenerator $router)
 {
     if (!empty($value['as_id'])) {
         preg_match_all('/{(.*?)}/', $route, $matches);
         $route = str_replace($matches[0], '{' . $value['as_id'] . '}', $route);
     }
     $port = parse_url($router->current(), PHP_URL_PORT);
     $port = null == $port ? '' : ':' . $port;
     $scheme = parse_url($router->current(), PHP_URL_SCHEME);
     $host = parse_url($router->current(), PHP_URL_HOST) . $port;
     return sprintf('%s://%s/%s', $scheme, $host, $route);
 }
开发者ID:nilportugues,项目名称:laravel5-hal-json,代码行数:19,代码来源:Laravel52Provider.php

示例3: isPage

 /**
  * Return true if current page is $page.
  */
 public function isPage(string $page, array $parameters = []) : bool
 {
     // Check if $page is a route name
     if ($this->route->has($page)) {
         if ($parameters) {
             return $this->url->current() == $this->url->route($page, $parameters);
         }
         return $this->route->currentRouteName() == $page;
     }
     return str_replace($this->request->root() . '/', '', $this->url->full()) == $page;
 }
开发者ID:atorscho,项目名称:laravel-helpers,代码行数:14,代码来源:Assertions.php

示例4: itemShouldBeActive

 /**
  * @param $link
  * @return bool
  */
 private function itemShouldBeActive($link)
 {
     if (is_string($link)) {
         return false;
     }
     $auto = $this->autoroute && $this->url->current() == $link['link'];
     $manual = isset($link['active']) && $link['active'];
     return $auto || $manual;
 }
开发者ID:armannadim,项目名称:restpos,代码行数:13,代码来源:Navigation.php

示例5: getAction

 /**
  * Get the form action from the options.
  *
  * @param  array   $options
  * @return string
  */
 protected function getAction(array $options)
 {
     // We will also check for a "route" or "action" parameter on the array so that
     // developers can easily specify a route or controller action when creating
     // a form providing a convenient interface for creating the form actions.
     if (isset($options['url'])) {
         return $this->getUrlAction($options['url']);
     }
     if (isset($options['route'])) {
         return $this->getRouteAction($options['route']);
     } elseif (isset($options['action'])) {
         return $this->getControllerAction($options['action']);
     }
     return $this->url->current();
 }
开发者ID:GeorgeShazkho,项目名称:micros-de-conce,代码行数:21,代码来源:FormBuilder.php

示例6: getAction

 /**
  * Get the form action from the options.
  *
  * @param  array   $options
  *
  * @return string
  */
 protected function getAction(array $options)
 {
     // We will also check for a "route" or "action" parameter on the array so that
     // developers can easily specify a route or controller action when creating
     // a form providing a convenient interface for creating the form actions.
     if (isset($options['url'])) {
         return $this->getUrlAction($options['url']);
     }
     // If an action is available, we are attempting to open a form to a controller
     // action route. So, we will use the URL generator to get the path to these
     // actions and return them from the method. Otherwise, we'll use current.
     if (isset($options['route'])) {
         return $this->getRouteAction($options['route']);
     } elseif (isset($options['action'])) {
         return $this->getControllerAction($options['action']);
     }
     return $this->url->current();
 }
开发者ID:stevebauman,项目名称:html,代码行数:25,代码来源:CreatorTrait.php

示例7: current

 /**
  * Get the current URL for the request.
  *
  * @return string 
  * @static 
  */
 public static function current()
 {
     return \Illuminate\Routing\UrlGenerator::current();
 }
开发者ID:satriashp,项目名称:tour,代码行数:10,代码来源:_ide_helper.php

示例8: getCurrentUrl

 /**
  * @inheritdoc
  */
 public function getCurrentUrl()
 {
     return $this->url->current();
 }
开发者ID:bkkrishna,项目名称:LaravelFacebookSdk,代码行数:7,代码来源:LaravelUrlDetectionHandler.php

示例9:

 function it_implements_routes_with_dynamic_parameters(UrlGenerator $url)
 {
     // Having
     $user_id = 20;
     $year = 2015;
     $month = 07;
     $day = 11;
     $account = "http://example.com/account/{$user_id}";
     $calendar = "http://example.com/calendar/{$year}/{$month}/{$day}";
     $url->current()->shouldBeCalled()->willReturn($account);
     $url->to('')->shouldBeCalled()->willReturn('http://example/');
     $url->route('account', [$user_id])->shouldBeCalled()->willReturn($account);
     $url->route('calendar', [$year, $month, $day])->shouldBeCalled()->willReturn($calendar);
     // Generate new menu
     $menu = $this->make(['account' => ['route' => ['account', ':user_id']], 'calendar' => ['route' => ['calendar', ':year', ':month', ':day']]]);
     // With dynamic parameters
     $menu->setParams(compact('year', 'month', 'day'));
     $menu->setParam('user_id', $user_id);
     $items = ['account' => ['class' => 'active', 'submenu' => null, 'id' => 'account', 'active' => true, 'title' => 'Account', 'url' => $account], 'calendar' => ['class' => '', 'submenu' => null, 'id' => 'calendar', 'active' => false, 'title' => 'Calendar', 'url' => $calendar]];
     $menu->getItems()->shouldReturn($items);
 }
开发者ID:phroggyy,项目名称:html,代码行数:21,代码来源:MenuGeneratorSpec.php

示例10: let

 function let(UrlGenerator $url)
 {
     $url->current()->willReturn('link');
     $this->beConstructedWith($url);
 }
开发者ID:AdrianSkierniewski,项目名称:bootstrapper,代码行数:5,代码来源:NavigationSpec.php

示例11: urlOrCurrent

 private function urlOrCurrent($url = null)
 {
     return $url === null ? $this->urlGenerator->current() : $url;
 }
开发者ID:laravel-commode,项目名称:navigation-bag,代码行数:4,代码来源:NavigationBag.php

示例12: isActive

 /**
  * Return true if current breadcrumb item is active.
  *
  * @return bool
  */
 public function isActive()
 {
     return $this->url == $this->routing->current();
 }
开发者ID:atorscho,项目名称:crumbs,代码行数:9,代码来源:CrumbsItem.php

示例13: addCurrent

 /**
  * Add current page to the breadcrumbs array.
  *
  * @param string $title
  *
  * @return $this
  */
 public function addCurrent($title)
 {
     return $this->add($this->url->current(), $title);
 }
开发者ID:atorscho,项目名称:crumbs,代码行数:11,代码来源:Crumbs.php


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