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


PHP Route::getUri方法代码示例

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


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

示例1: addToCollections

 /**
  * Add the given route to the arrays of routes.
  *
  * @param  \Illuminate\Routing\Route  $route
  * @return void
  */
 protected function addToCollections($route)
 {
     foreach ($route->methods() as $method) {
         $this->routes[$method][$route->domain() . $route->getUri()] = $route;
     }
     $this->allRoutes[$method . $route->domain() . $route->getUri()] = $route;
 }
开发者ID:ahumellihuk,项目名称:blogging-platform,代码行数:13,代码来源:RouteCollection.php

示例2: addToCollections

 /**
  * Add the given route to the arrays of routes.
  *
  * @param  \Illuminate\Routing\Route $route
  * @return void
  */
 protected function addToCollections($route)
 {
     $domainAndUri = $route->domain() . $route->getUri() . $route->getPriority();
     foreach ($route->methods() as $method) {
         $this->routes[$method][$domainAndUri] = $route;
     }
     $this->allRoutes[$method . $domainAndUri] = $route;
 }
开发者ID:langaner,项目名称:route-priority,代码行数:14,代码来源:RouteCollection.php

示例3: isAlternate

 public function isAlternate(LaravelRoute $route)
 {
     if (!$route instanceof Route) {
         return false;
     }
     // Validate methods
     if ($this->methods() != $route->methods()) {
         return false;
     }
     // Validate scheme
     if ($this->httpOnly() !== $route->httpOnly()) {
         return false;
     }
     // Validate base uri
     if ($this->getBaseUri() !== $route->getBaseUri()) {
         return false;
     }
     if ($this->getUri() === $route->getUri()) {
         return false;
     }
     return true;
 }
开发者ID:exolnet,项目名称:laravel-routing,代码行数:22,代码来源:Route.php

示例4: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index(Route $route)
 {
     return view('pages.category_index')->with('data', ['items' => $this->getModel(), 'route' => $route, 'uri' => $route->getUri(), 'body_class' => $route->getUri(), 'title' => $this->getPageTitle()]);
 }
开发者ID:allen-garvey,项目名称:personal-website-3,代码行数:9,代码来源:ArrayController.php

示例5: subordinates

 /**
  * Returns a given route's children as an array. A parent route like /users would return (if they existed) all routes
  * like /users/{userid}, /users/new.
  *
  * @param Route $parentRoute
  * @return Route[]
  */
 public function subordinates(Route $parentRoute)
 {
     if (array_key_exists($parentRoute->getUri(), $this->subordinateRouteCache)) {
         return $this->subordinateRouteCache[$parentRoute->getUri()];
     }
     $routes = $this->router->getRoutes();
     $children = [];
     /** @var Route $route */
     foreach ($routes as $route) {
         if (!self::isValid($route)) {
             continue;
         }
         // if the route does not start with the same uri as the current route -> skip
         if ($parentRoute->getUri() != '/' && !starts_with($route->getUri(), $parentRoute->getUri())) {
             continue;
         }
         // if route equals the parent route
         if ($parentRoute->getActionName() == $route->getActionName()) {
             continue;
         }
         $children[] = $route;
     }
     return $this->subordinateRouteCache[$parentRoute->getUri()] = $children;
 }
开发者ID:jarischaefer,项目名称:hal-api,代码行数:31,代码来源:RouteHelper.php

示例6: getUri

 /**
  * @param Route $route
  *
  * @return mixed
  */
 protected function getUri($route)
 {
     return $route->getUri();
 }
开发者ID:mpociot,项目名称:laravel-apidoc-generator,代码行数:9,代码来源:LaravelGenerator.php

示例7: getUri

 /**
  * @return string
  */
 public function getUri()
 {
     return parent::getUri() . $this->getRouteIntent();
 }
开发者ID:develpr,项目名称:alexa-app,代码行数:7,代码来源:AlexaRoute.php

示例8: generateJsString

 private function generateJsString(Route $route)
 {
     $jsRoutes = "'" . $this->appUrl . '/' . $route->getUri() . "',";
     return $jsRoutes;
 }
开发者ID:herlevsen,项目名称:laravel-route-bookmarker,代码行数:5,代码来源:RouteBookmarkerCommand.php

示例9: generateStandartRoute

 /**
  * Generate Route into standart routing in route file
  *
  * @param string $route_file
  * @param Illuminate\Routing\Route $route
  * @return void
  */
 protected function generateStandartRoute($route_file, Route $route)
 {
     $route_methods = $route->getMethods();
     $method = '';
     $uri = $route->getUri();
     $extra_param = '';
     // first param for Route::match
     switch ($route_methods) {
         case ['GET', 'HEAD']:
         case ['GET']:
             $method = 'get';
             break;
         case ['POST']:
         case ['PUT']:
         case ['PATCH']:
         case ['DELETE']:
             $method = strtolower($route_methods[0]);
             break;
         default:
             $method = 'match';
             $arr_methods = array_map(function ($val) {
                 return "'" . strtolower($val) . "'";
             }, $route_methods);
             $extra_param = '[' . implode(', ', $arr_methods) . ']';
     }
     $action = $route->getAction();
     $action_data = [];
     $uses = str_replace($action['namespace'] . "\\", "", $action['uses']);
     $action_data['uses'] = "'uses' => '{$uses}'";
     if (!empty($action['as'])) {
         $action_data['as'] = "'as' => '" . $action['as'] . "'";
     }
     if (!empty($action['middleware'])) {
         $action_data['middleware'] = "'middleware' => '" . implode('|', $action['middleware']) . "'";
     }
     if (!empty($action['prefix'])) {
         $action_data['prefix'] = "'prefix' => '" . $action['prefix'] . "'";
     }
     // if only action uses in action_data, just use string as action
     if (1 == count($action_data) and array_key_exists('uses', $action_data)) {
         $code_action_params = "'{$uses}'";
     } else {
         $code_action_params = "[\n\t" . implode(",\n\t", $action_data) . "\n]";
     }
     $route_params = [];
     if (!empty($extra_param)) {
         $route_params[] = $extra_param;
     }
     $route_params[] = "'{$uri}'";
     $route_params[] = $code_action_params;
     $route_code = "\nRoute::{$method}(" . implode(', ', $route_params) . ")";
     $code_conditions = [];
     foreach ($route->conditions as $param => $regex) {
         $code_conditions[] = "->where('{$param}', '{$regex}')";
     }
     $route_code .= implode("\n", $code_conditions) . ";";
     if (false == $this->option("no-comment")) {
         $code_comment = "\n\n/*" . "\n | -----------------------------------------------------------" . "\n | Route " . (isset($action['as']) ? "'" . $action['as'] . "'" : "") . "\n | -----------------------------------------------------------" . (!empty($route->description) ? "\n | " . str_replace("\n", "\n | ", $route->description) . "\n | " : "") . "\n | generated at: " . date('Y-m-d H:i:s') . "\n |" . "\n */";
         $route_code = $code_comment . $route_code;
     } else {
         $route_code = "\n" . $route_code;
     }
     file_put_contents($route_file, file_get_contents($route_file) . $route_code);
 }
开发者ID:emsifa,项目名称:route-annotation,代码行数:71,代码来源:StandarizeRouteCommand.php


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