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


PHP Route::getName方法代碼示例

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


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

示例1: link

 /**
  * 메뉴의 링크를 생성하여 반환한다. 메뉴에 link정보가 있을 경우 link정보를 우선 사용하여 생성한다.
  * 그 다음으로 메뉴에 연결된 route정보를 사용하여 링크를 생성한다.
  *
  * @return Route|mixed|string
  * @throws \Exception
  */
 public function link()
 {
     if ($this->display === false) {
         return '#';
     }
     // menu에 링크 정보가 있을 경우
     if ($this->link !== null) {
         if ($this->link instanceof Closure) {
             return $this->link();
         } else {
             return $this->link;
         }
     }
     // 어떤 링크정보도 찾을 수 없으면 #
     if ($this->route === null) {
         return '#';
     }
     // route 정보 사용
     if ($name = $this->route->getName()) {
         return route($name);
     } elseif ($action = $this->route->getActionName()) {
         if ($action !== 'Closure') {
             return action($action);
         }
     }
     throw new LinkNotFoundException('admin 메뉴가 지정된 route는 name(as)이 지정되어 있거나 Controller action이어야 합니다.');
 }
開發者ID:qkrcjfgus33,項目名稱:xpressengine,代碼行數:34,代碼來源:SettingsMenu.php

示例2: filterRouteAsClass

 protected function filterRouteAsClass(Route $route)
 {
     if ($this->option('name') && !str_contains($route->getName(), $this->option('name')) || $this->option('path') && !str_contains(implode('|', $route->methods()) . ' ' . $route->uri(), $this->option('path'))) {
         return null;
     }
     return $route;
 }
開發者ID:fisdap,項目名稱:laravel-console-extensions,代碼行數:7,代碼來源:RouteFiltersListCommand.php

示例3: hasToBeAuthorized

 /**
  * Determines if routes has to be authorized.
  *
  * @return bool
  */
 protected function hasToBeAuthorized()
 {
     if (in_array($this->route->getName(), self::$except)) {
         return false;
     }
     return (bool) $this->route->getName();
 }
開發者ID:adrianyg7,項目名稱:Acl,代碼行數:12,代碼來源:AclPolicy.php

示例4: getRouteInformation

 /**
  * Get the route information for a given route.
  *
  * @param $route \Illuminate\Routing\Route
  * @param $filter string
  * @param $namespace string
  *
  * @return array
  */
 protected function getRouteInformation(Route $route, $filter, $namespace)
 {
     $host = $route->domain();
     $methods = $route->getMethods();
     $uri = $route->uri();
     $name = $route->getName();
     $action = $route->getActionName();
     $jsroute = array_get($route->getAction(), 'jsroute', null);
     if (!empty($namespace)) {
         $a = $route->getAction();
         if (isset($a['controller'])) {
             $action = str_replace($namespace . '\\', '', $action);
         }
     }
     switch ($filter) {
         case 'all':
             if ($jsroute === false) {
                 return null;
             }
             break;
         case 'only':
             if ($jsroute !== true) {
                 return null;
             }
             break;
     }
     return compact('host', 'methods', 'uri', 'name', 'action');
 }
開發者ID:jeylabs,項目名稱:jsroute,代碼行數:37,代碼來源:Collection.php

示例5: link

 /**
  * 메뉴의 링크를 생성하여 반환한다. 메뉴에 link정보가 있을 경우 link정보를 우선 사용하여 생성한다.
  * 그 다음으로 메뉴에 연결된 route정보를 사용하여 링크를 생성한다.
  *
  * @return Route|mixed|string
  * @throws \Exception
  */
 public function link()
 {
     if ($this->display === false) {
         return null;
     }
     // menu에 링크 정보가 있을 경우
     if ($this->link !== null) {
         if ($this->link instanceof Closure) {
             return $this->link();
         } else {
             return $this->link;
         }
     }
     // 어떤 링크정보도 찾을 수 없으면 #
     if ($this->route === null) {
         return null;
     }
     // route 정보 사용
     if ($name = $this->route->getName()) {
         return route($name);
     } elseif ($action = $this->route->getActionName()) {
         if ($action !== 'Closure') {
             return action($action);
         }
     }
     throw new LinkNotFoundException();
 }
開發者ID:xpressengine,項目名稱:xpressengine,代碼行數:34,代碼來源:SettingsMenu.php

示例6: rules

 public function rules(Route $route)
 {
     if ($route->getName() == 'backend.backend.users.update') {
         $rules = ['user.email' => 'required|unique:backend_users,email,' . $route->parameter('id'), 'user.active' => 'required', 'groups' => 'required'];
     } else {
         $rules = ['user.email' => 'required|unique:backend_users,email', 'user.active' => 'required', 'groups' => 'required', 'password' => 'required'];
     }
     return $rules;
 }
開發者ID:rabbitcms,項目名稱:backend,代碼行數:9,代碼來源:UsersRequest.php

示例7: setupDefaults

 /**
  * @return $this
  */
 protected function setupDefaults()
 {
     $this->route = Route::current();
     if (method_exists($this->route, 'getName') && !empty($this->route->getName())) {
         $this->template = $this->route()->getName();
         $this->setTypeAndFormAction()->setTypeName()->setModelInstance();
     }
     return $this;
 }
開發者ID:garbleapp,項目名稱:garble,代碼行數:12,代碼來源:TextController.php

示例8: generateTableRow

 private function generateTableRow(Route $route)
 {
     $tableRow = "";
     $tableRow .= '<tr>';
     $tableRow .= '<td>' . $route->getName() . '</td>';
     $tableRow .= '<td><a href="' . $this->appUrl . '/' . $route->getUri() . '" target="_blank">' . $this->appUrl . '/' . $route->getPath() . '</a></td>';
     $tableRow .= '</tr>';
     return $tableRow;
 }
開發者ID:herlevsen,項目名稱:laravel-route-bookmarker,代碼行數:9,代碼來源:RouteBookmarkerCommand.php

示例9: route

 /**
  * Returns the output if the specified route
  * is the current route.
  *
  * @param string $route
  *
  * @return null|string
  */
 public function route($route)
 {
     $current = $this->route->getName();
     if ($this->containsWildcard($route)) {
         // If the specified route contains a wildcard we'll remove it.
         $route = $this->stripWildcard($route);
         if (str_contains($current, $route)) {
             // We'll check if the stripped route exists inside the current
             // route and return the output if that is the case.
             return $this->output;
         }
     }
     // If the route does not contain a wildcard we'll check if the
     // current route equals the specified route loosely.
     if ($current == $route) {
         return $this->output;
     }
     return;
 }
開發者ID:stevebauman,項目名稱:active,代碼行數:27,代碼來源:Active.php

示例10: addWhereClausesToRoute

 /**
  * Add the necessary where clauses to the route based on its initial registration.
  *
  * @param  \Illuminate\Routing\Route  $route
  * @return \Illuminate\Routing\Route
  */
 protected function addWhereClausesToRoute($route)
 {
     foreach ($this->get_patterns_defaults() as $key => $value) {
         $route->defaults($key, $value);
     }
     if ($route->getName() == 'page') {
         #dd($route);
     }
     parent::addWhereClausesToRoute($route);
 }
開發者ID:Grapheme,項目名稱:amway,代碼行數:16,代碼來源:CustomRouter.php

示例11: checkRoutePattern

 /**
  * Check the current route name with one or some patterns
  *
  * @param array $patterns
  *
  * @return bool
  */
 public function checkRoutePattern(array $patterns)
 {
     if (!$this->route) {
         return false;
     }
     $routeName = $this->route->getName();
     foreach ($patterns as $p) {
         if (str_is($p, $routeName)) {
             return true;
         }
     }
     return false;
 }
開發者ID:yinniermei,項目名稱:active,代碼行數:20,代碼來源:Active.php

示例12: hasAccess

 /**
  * User has access to a route ?
  */
 public function hasAccess(\Illuminate\Routing\Route $route, \Illuminate\Http\Request $request, $value = 'chose')
 {
     $value = $value ?: $route->getName();
     try {
         $user = Sentry::getUser();
         if (!$user->hasAccess($value)) {
             App::abort(403);
         }
     } catch (UserNotFoundException $e) {
         Notification::error($e->getMessage() . '\\n' . $request->fullUrl());
         return Redirect::guest(route('login'));
     }
 }
開發者ID:mrkodssldrf,項目名稱:TypiCMS,代碼行數:16,代碼來源:UsersFilter.php

示例13: setPageType

 public function setPageType(Route $route, CmsRequestInterface $request)
 {
     if (!($cmsPath = $request->getCmsPath())) {
         return;
     }
     // If a page match did happen the request already has a pagetype
     if ($cmsPath->isCmsPath()) {
         return;
     }
     if (!($pageType = $this->pageTypes->getByRouteName($route->getName()))) {
         return;
     }
     $request->getCmsPath()->setPageType($pageType);
 }
開發者ID:realholgi,項目名稱:cmsable,代碼行數:14,代碼來源:PageTypeRouter.php

示例14: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id, Route $route)
 {
     $action = $route->getName();
     $action = explode('.', $action);
     $action = array_pop($action);
     //Listas
     $generos = Sexo::all();
     $estados = Estado::orderBy('descripcion')->lists('descripcion', 'id');
     $escuelas = Escuela::all()->lists('nombre', 'id');
     $grupos = Grupo::all()->lists('descripcion', 'id');
     //
     $maestro = User::findOrFail($id);
     $form_data = ['route' => ['admin.maestro.update', $maestro->id], 'method' => 'PUT'];
     $title = 'Editar maestro';
     return view('admin.maestro.form')->with(compact('maestro', 'form_data', 'title', 'generos', 'estados', 'grupos', 'escuelas', 'action'));
 }
開發者ID:ericray,項目名稱:test,代碼行數:22,代碼來源:MaestroController.php

示例15: parseRoute

 function parseRoute(Route $route)
 {
     $this->pushBreadcrumb(self::HOME_ROUTE);
     $routeName = $route->getName();
     Breadcrumbs::register($routeName, function ($breadcrumbs) use($routeName) {
         $specifiers = func_get_args();
         array_shift($specifiers);
         $specific = [];
         $parts = $this->expandRoute($routeName);
         $parent = null;
         while ($part = array_shift($parts)) {
             if (strpos($parent, '.' . static::INDEX_ROUTE) !== false) {
                 $parentRoute = str_replace('.' . static::INDEX_ROUTE, '', $parent);
             } else {
                 $parentRoute = $parent;
             }
             $current = $parent ? "{$parentRoute}.{$part}" : $part . '.' . static::INDEX_ROUTE;
             $resolved = $this->resolveRoute($current, $part);
             $route = explode('.', $resolved);
             $part = array_pop($route);
             $specifier = null;
             if (str_contains($part, $this->entitied)) {
                 if (!$this->lastIs(static::INDEX_ROUTE)) {
                     $this->pushBreadcrumb($this->traversed($resolved, static::INDEX_ROUTE), $specific);
                 }
                 $specifier = array_shift($specifiers);
                 $specific[] = $specifier;
             }
             if ($this->routeExists($resolved)) {
                 $this->pushBreadcrumb($resolved, $specific);
             } else {
                 throw new \Exception("Route [{$current}] don't exists");
             }
             $parent = $current;
         }
         $unique = [];
         $parent = null;
         foreach ($this->crumbs as $route) {
             if (array_search($route[0], $unique) !== false) {
                 continue;
             }
             $this->pushRoute($breadcrumbs, $parent, $route[0], $route[1]);
             $unique[] = $parent = $route[0];
         }
     });
 }
開發者ID:ankhzet,項目名稱:Ankh,代碼行數:46,代碼來源:Crumbs.php


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