当前位置: 首页>>代码示例>>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;未经允许,请勿转载。