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


PHP UrlGenerator::route方法代碼示例

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


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

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

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

示例3: renderHead

 /**
  * {@inheritdoc}
  */
 public function renderHead()
 {
     if (!$this->url) {
         return parent::renderHead();
     }
     $jsModified = $this->getModifiedTime('js');
     $cssModified = $this->getModifiedTime('css');
     $html = '';
     $html .= sprintf('<link rel="stylesheet" type="text/css" href="%s?%s">' . "\n", $this->url->route('debugbar.assets.css'), $cssModified);
     $html .= sprintf('<script type="text/javascript" src="%s?%s"></script>' . "\n", $this->url->route('debugbar.assets.js'), $jsModified);
     if ($this->isJqueryNoConflictEnabled()) {
         $html .= '<script type="text/javascript">jQuery.noConflict(true);</script>' . "\n";
     }
     return $html;
 }
開發者ID:nvq247,項目名稱:Kxexnxh,代碼行數:18,代碼來源:JavascriptRenderer.php

示例4: renderHead

 /**
  * {@inheritdoc}
  */
 public function renderHead()
 {
     if (!$this->url) {
         return parent::renderHead();
     }
     $cssRoute = $this->url->route('debugbar.assets.css', ['v' => $this->getModifiedTime('css')]);
     $jsRoute = $this->url->route('debugbar.assets.js', ['v' => $this->getModifiedTime('js')]);
     $html = '';
     $html .= "<link rel='stylesheet' type='text/css' href='{$cssRoute}'>";
     $html .= "<script type='text/javascript' src='{$jsRoute}'></script>";
     if ($this->isJqueryNoConflictEnabled()) {
         $html .= '<script type="text/javascript">jQuery.noConflict(true);</script>' . "\n";
     }
     return $html;
 }
開發者ID:rash039,項目名稱:mystic,代碼行數:18,代碼來源:JavascriptRenderer.php

示例5: action

 /**
  * Perform an API request to a controller action.
  *
  * @param  string  $action
  * @param  string|array  $actionParameters
  * @param  string|array  $parameters
  * @return mixed
  */
 public function action($action, $actionParameters = [], $parameters = [])
 {
     $version = $this->version ?: $this->router->getDefaultVersion();
     $route = $this->router->getApiRouteCollection($version)->getByAction($action);
     $uri = ltrim($this->url->route($action, $actionParameters, false, $route), '/');
     return $this->queueRequest($route->methods()[0], $uri, $parameters);
 }
開發者ID:iwillhappy1314,項目名稱:laravel-admin,代碼行數:15,代碼來源:Dispatcher.php

示例6: url

 /**
  * Get a URL for a given page number.
  *
  * @param integer $page
  * @return string
  */
 public function url($page)
 {
     if (null === $this->routeConfig) {
         //return parent::url($page);
         if ($page <= 0) {
             $page = 1;
         }
         // If we have any extra query string key / value pairs that need to be added
         // onto the URL, we will put them in query string form and then attach it
         // to the URL. This allows for extra information like sortings storage.
         $parameters = [$this->pageName => $page];
         if (count($this->query) > 0) {
             $parameters = array_merge($this->query, $parameters);
         }
         return $this->getCurrentUrl() . '?' . http_build_query($parameters, null, '&') . $this->buildFragment();
     }
     $parameters = $this->routeConfig['parameters'];
     //$parameters = [$this->pageName => $page];
     //$this->getRequest()->query()
     if (true === $this->withQuery) {
         $parameters = array_merge($parameters, $this->query);
     }
     $parameters[$this->getPageName()] = $page;
     $absolute = null === $this->routeConfig['absolute'] ? true : $this->routeConfig['absolute'];
     // allow adding hash fragments to url
     $fragment = $this->buildFragment();
     $generated_route = $this->urlGenerator->route($this->routeConfig['name'], $parameters, $absolute, $this->routeConfig['instance']);
     return $generated_route . $fragment;
 }
開發者ID:thinkme,項目名稱:pagination,代碼行數:35,代碼來源:Paginator.php

示例7: getRoute

 /**
  * Get the route action for a "route" option.
  *
  * @param  array|string  $route
  * @return string
  */
 protected function getRoute($route)
 {
     if (is_array($route)) {
         return $this->url->route($route[0], array_slice($route, 1));
     }
     return $this->url->route($route);
 }
開發者ID:filipac,項目名稱:menus,代碼行數:13,代碼來源:Builder.php

示例8: getRouteAction

 /**
  * 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);
 }
開發者ID:GeorgeShazkho,項目名稱:micros-de-conce,代碼行數:13,代碼來源:FormBuilder.php

示例9: parseUrl

 /**
  * Return a named route if it exists.
  *
  * @param string $url
  * @param array  $parameters
  *
  * @return string
  */
 protected function parseUrl($url, $parameters)
 {
     // If provided $url is a route name...
     if ($this->route->has($url)) {
         $url = $this->url->route($url, $parameters);
     } else {
         $url = $this->url->to($url, $parameters);
     }
     return $url;
 }
開發者ID:atorscho,項目名稱:crumbs,代碼行數:18,代碼來源:Crumbs.php

示例10: route

 /**
  * Get the URL to a named route.
  *
  * @param  string  $name
  * @param  mixed   $parameters
  * @param  bool  $absolute
  * @param  \Illuminate\Routing\Route  $route
  * @return string
  *
  * @throws \InvalidArgumentException
  */
 public function route($name, $parameters = array(), $absolute = true, $route = null)
 {
     if ($path = $this->getPathFinder()->toRouteName($name, $parameters)) {
         if ($absolute) {
             return $this->to($path);
         }
         return $path;
     }
     return parent::route($name, $parameters, $absolute, $route);
 }
開發者ID:realholgi,項目名稱:cmsable,代碼行數:21,代碼來源:SiteTreeUrlGenerator.php

示例11: dispatch

 /**
  * Get the action type from the options.
  *
  * @param  array  $options
  * @return string
  */
 public function dispatch($options)
 {
     if (isset($options['url'])) {
         return $this->getUrl($options);
     } elseif (isset($options['route'])) {
         return $this->url->route($options['route']);
     } elseif (isset($options['action'])) {
         return $this->url->action($options['action']);
     }
     return null;
 }
開發者ID:cloud5ideas,項目名稱:appkit,代碼行數:17,代碼來源:Builder.php

示例12: getUrl

 /**
  * Get a URL for a given page number.
  *
  * @param integer $page
  * @return string
  */
 public function getUrl($page)
 {
     if (null === $this->routeConfig) {
         return parent::getUrl($page);
     }
     $parameters = $this->routeConfig['parameters'];
     if (true === $this->withQuery) {
         $parameters = array_merge($parameters, $this->factory->getRequest()->query());
     }
     $parameters[$this->factory->getPageName()] = $page;
     $absolute = null === $this->routeConfig['absolute'] ? true : $this->routeConfig['absolute'];
     // allow adding hash fragments to url
     $fragment = $this->buildFragment();
     $generated_route = $this->urlGenerator->route($this->routeConfig['name'], $parameters, $absolute, $this->routeConfig['instance']);
     return $generated_route . $fragment;
 }
開發者ID:desmart,項目名稱:pagination,代碼行數:22,代碼來源:Paginator.php

示例13: getAutologinLink

 /**
  * Get the link that can be used to automatically login a user to the 
  * application.
  *
  * @param  \Illuminate\Auth\UserInterface  $user
  * @param  string  $path
  * @return string
  */
 protected function getAutologinLink(UserInterface $user, $path = null)
 {
     // If we are supposed to remove expired tokens, let's do it now.
     if (config('autologin.remove_expired')) {
         $this->deleteExpiredTokens();
     }
     // Get the user ID to be associated with a token.
     $userId = $user->getAuthIdentifier();
     // Generate a random unique token that can be used for the link.
     $token = $this->getAutologinToken();
     // Save the token to storage.
     $this->provider->create(['user_id' => $userId, 'token' => $token, 'path' => $path]);
     // Return a link using the route from the configuration file and
     // the generated token.
     $routeName = config('autologin.route_name');
     return $this->generator->route($routeName, $token);
 }
開發者ID:vicakazu,項目名稱:autologin,代碼行數:25,代碼來源:Autologin.php

示例14: __call

 /**
  * @param string $method
  * @param array $parameters
  * @throws MethodNotFoundException
  */
 public function __call($method, $parameters)
 {
     if (preg_match('/^routeTo(?<routeName>[a-zA-Z]+)$/', $method, $matches)) {
         $route = Str::camel($matches['routeName']);
         while (count($parameters) < 2) {
             $parameters[] = [];
         }
         if (!is_array($parameters[1])) {
             $parameters[1] = [$parameters[1]];
         }
         $routeParameters = $parameters[1];
         array_unshift($routeParameters, $parameters[0]);
         return $this->urlGenerator->route($this->routePrefix . '.table.' . $route, $routeParameters);
     }
     if (method_exists($this->laravelRouter, $method)) {
         return $this->laravelRouter->group(['prefix' => $this->prefix, 'before' => $this->getBeforeFilters()], function () use($method, $parameters) {
             call_user_func_array([$this->laravelRouter, $method], $parameters);
         });
     }
     throw new MethodNotFoundException(get_class($this), $method);
 }
開發者ID:GlobalsDD,項目名稱:admin,代碼行數:26,代碼來源:Router.php

示例15: generate

 /**
  * @todo - run this to ensure it generates the correct routes
  * @param $name
  * @param array $parameters
  * @param $referenceType
  * @return string
  */
 public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH)
 {
     $refType = $referenceType === self::ABSOLUTE_PATH;
     return $this->urlGenerator->route($name, $parameters, $refType);
 }
開發者ID:ppi,項目名稱:ppi-laravel-router,代碼行數:12,代碼來源:LaravelRouterWrapper.php


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