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


PHP RouteCollection::getByName方法代码示例

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


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

示例1: route

 /**
  * Get the URL to a named route.
  *
  * @param  string  $name
  * @param  mixed   $parameters
  * @param  bool  $absolute
  * @return string
  *
  * @throws \InvalidArgumentException
  */
 public function route($name, $parameters = [], $absolute = true)
 {
     if (!is_null($route = $this->routes->getByName($name))) {
         return $this->toRoute($route, $parameters, $absolute);
     }
     throw new InvalidArgumentException("Route [{$name}] not defined.");
 }
开发者ID:hilmysyarif,项目名称:sisfito,代码行数:17,代码来源:UrlGenerator.php

示例2: 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)
 {
     $route = $route ?: $this->routes->getByName($name);
     $parameters = (array) $parameters;
     if (!is_null($route)) {
         return $this->toRoute($route, $parameters, $absolute);
     }
     throw new InvalidArgumentException("Route [{$name}] not defined.");
 }
开发者ID:solangegamboa,项目名称:teste-php,代码行数:20,代码来源:UrlGenerator.php

示例3: makesByType

 /**
  * Make permission instances by type
  *
  * @param string                $type    type string
  * @param MemberEntityInterface $user    user instance
  * @param string                $siteKey site key
  * @return Permission[]
  * @throws NotMatchedInstanceException
  */
 public function makesByType($type, MemberEntityInterface $user = null, $siteKey = 'default')
 {
     $user = $user ?: $this->auth->user();
     $permissions = [];
     $registereds = $this->repo->fetchByType($siteKey, $type);
     foreach ($registereds as $registered) {
         $ancestors = array_filter($registereds, function ($item) use($registered) {
             $itemNames = explode('.', $item->name);
             $registeredNames = explode('.', $registered->name);
             if (count($itemNames) >= count($registeredNames)) {
                 return false;
             }
             for ($i = 0; $i < count($itemNames); $i++) {
                 if ($itemNames[$i] !== $registeredNames[$i]) {
                     return false;
                 }
             }
             return true;
         });
         if (count($ancestors) > 0) {
             uasort($ancestors, [$this, 'cmp']);
         }
         foreach ($ancestors as $ancestor) {
             $registered->addParent($ancestor);
         }
         if (isset($this->extends[$type]) === true) {
             $permission = $this->extends[$type]($registered->name, $user, $registered);
             if ($permission instanceof Permission === false) {
                 throw new NotMatchedInstanceException(['type' => $type]);
             }
             $permissions[$registered->name] = $permission;
         } else {
             switch ($type) {
                 case 'route':
                     $route = $this->routes->getByName($registered->name);
                     $permissions[$registered->name] = new RoutePermission($route, $user, $registered);
                     break;
                 case 'instance':
                     $permissions[$registered->name] = new InstancePermission($registered->name, $user, $registered);
                     break;
             }
         }
     }
     return $permissions;
 }
开发者ID:qkrcjfgus33,项目名称:xpressengine,代码行数:54,代码来源:Factory.php

示例4: resolveControllerByName

 /**
  * @param RouteCollection $routes
  *
  * @return Controller
  *
  * @throws ShapeShifterException
  */
 protected function resolveControllerByName(RouteCollection $routes)
 {
     $contr = $routes->getByName($this->destination);
     if (!$contr) {
         throw new ShapeShifterException("Route [{$this->destination}] does not exist");
     }
     list($class) = explode('@', $contr->getActionName());
     return app($class);
 }
开发者ID:wearejust,项目名称:shapeshifter,代码行数:16,代码来源:OneToManyRelation.php

示例5: assertHasNamedRoute

 protected function assertHasNamedRoute($name)
 {
     $this->getRoutes();
     $this->assertNotNull($this->routeCol->getByName($name), "Missing named route {$name}");
 }
开发者ID:newmarkets,项目名称:content,代码行数:5,代码来源:TestCase.php


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