當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。