當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。