當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Routing\UrlGenerator類代碼示例

本文整理匯總了PHP中Illuminate\Routing\UrlGenerator的典型用法代碼示例。如果您正苦於以下問題:PHP UrlGenerator類的具體用法?PHP UrlGenerator怎麽用?PHP UrlGenerator使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了UrlGenerator類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: boot

 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot(UrlGenerator $url)
 {
     //
     if (env('APP_ENV') !== 'local') {
         $url->forceSchema('https');
     }
 }
開發者ID:danielsamfdo,項目名稱:applara,代碼行數:12,代碼來源:AppServiceProvider.php

示例2: __construct

 public function __construct(UrlGenerator $url)
 {
     $this->middleware('auth');
     $this->middleware('permission:dashboard')->only('getIndex');
     $this->prev = $url->previous();
     $this->module = 'admin';
 }
開發者ID:solunes,項目名稱:master,代碼行數:7,代碼來源:AdminController.php

示例3:

 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

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

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

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

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

示例8: testPutURL

 public function testPutURL()
 {
     $this->sessionStorage->expects($this->exactly(2))->method('put');
     $this->urlGenerator->expects($this->once())->method('current')->will($this->returnValue('http://' . uniqid() . '.com'));
     $this->testInstance->putURL(uniqid());
     $this->testInstance->putURL(uniqid(), 'http://link.com');
 }
開發者ID:laravel-commode,項目名稱:navigation-bag,代碼行數:7,代碼來源:NavigationBagTest.php

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

示例10: compose

 /**
  * @param View $view
  */
 public function compose(View $view)
 {
     $view->cruddyData = $this->cruddy->data();
     $view->cruddyData += ['schemaUrl' => $this->url->route('cruddy.schema'), 'thumbUrl' => $this->url->route('cruddy.thumb'), 'baseUrl' => $this->url->route('cruddy.home'), 'root' => $this->request->root(), 'token' => csrf_token()];
     $view->scripts = $this->assets->scripts();
     $view->styles = $this->assets->styles();
     $view->menu = $this->menuBuilder;
 }
開發者ID:guratr,項目名稱:cruddy,代碼行數:11,代碼來源:LayoutComposer.php

示例11: the_default_config_can_be_overwritten_by_passing_arguments_to_get_login_url

 /** @test */
 public function the_default_config_can_be_overwritten_by_passing_arguments_to_get_login_url()
 {
     $this->url_mock->shouldReceive('to')->with('https://poop.fart/callback')->once()->andReturn('https://poop.fart/callback');
     $this->config_mock->shouldReceive('get')->never();
     $login_url = $this->laravel_facebook_sdk->getLoginUrl(['dance', 'totes'], 'https://poop.fart/callback');
     $this->assertContains('redirect_uri=https%3A%2F%2Fpoop.fart%2Fcallback', $login_url);
     $this->assertContains('scope=dance%2Ctotes', $login_url);
 }
開發者ID:abada,項目名稱:videoGame,代碼行數:9,代碼來源:LaravelFacebookSdkTest.php

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

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

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

示例15: getIndex

 public function getIndex($status = '')
 {
     $threadCount = $this->request->get('take', $this->threadsPerPage);
     $tags = $this->tags->getAllTagsBySlug($this->request->get('tags'));
     $threads = $this->threads->getByTagsAndStatusPaginated($tags, $status, $threadCount);
     $collection = $threads->getCollection();
     $collection->each(function ($thread) {
         $thread->url = $this->url->action('ForumController@getViewThread', ['slug' => $thread->slug]);
     });
     // We want the newest threads to come out in chronological order
     return $collection->reverse();
 }
開發者ID:sdlyhu,項目名稱:laravelio,代碼行數:12,代碼來源:ForumThreadsController.php


注:本文中的Illuminate\Routing\UrlGenerator類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。