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


PHP Route::getActionName方法代码示例

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


在下文中一共展示了Route::getActionName方法的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: handle

 /**
  * @param Request  $request
  * @param callable $next
  * @return mixed
  */
 public function handle(Request $request, \Closure $next)
 {
     $action = $this->route->getActionName();
     $actionMethod = substr($action, strpos($action, "@") + 1);
     $segmentPosition = $this->getSegmentPosition($request);
     $moduleName = $this->getModuleName($request, $segmentPosition);
     $entityName = $this->getEntityName($request, $segmentPosition);
     $permission = $this->getPermission($moduleName, $entityName, $actionMethod);
     if (!$this->auth->hasAccess($permission)) {
         Flash::error(trans('core::core.permission denied', ['permission' => $permission]));
         return Redirect::back();
     }
     return $next($request);
 }
开发者ID:Houbsi,项目名称:Core,代码行数:19,代码来源:PermissionMiddleware.php

示例3: 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

示例4: __construct

 public function __construct(Route $route)
 {
     $this->middleware(function ($request, $next) {
         // if session is not set get it from .env SHOP_CODE
         if (!$request->session()->has('shop')) {
             $shop = Shop::where('code', config('app.shop_code'))->first();
             $request->session()->put('shop', $shop->id);
         }
         // if limit is not set default pagination limit
         if (!$request->session()->has('limit')) {
             $request->session()->put('limit', 100);
         }
         // if session is not set reset the session for the language
         if (!$request->session()->has('language')) {
             $request->session()->put('language', config('app.locale'));
         }
         // if session is not set reset the session for the basket
         if (!$request->session()->has('basket')) {
             $request->session()->put('basket', ['subtotal' => 0, 'count' => 0, 'items' => []]);
         }
         // global list of categories
         $categories = Category::where('shop_id', $request->session()->get('shop'))->orderBy('order', 'asc')->get();
         // share globals
         view()->share('language', $request->session()->get('language'));
         view()->share('categories', $categories);
         return $next($request);
     });
     // add controller & action to the body class
     $currentAction = $route->getActionName();
     list($controller, $method) = explode('@', $currentAction);
     $controller = preg_replace('/.*\\\\/', '', $controller);
     $action = preg_replace('/.*\\\\/', '', $method);
     view()->share('body_class', $controller . '-' . $action);
 }
开发者ID:kudosagency,项目名称:kudos-php,代码行数:34,代码来源:ThemeController.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: getControllerName

function getControllerName()
{
    $route = new Route();
    print $route->getActionName();
    print "<br />";
    print $route->getAction();
}
开发者ID:hasanbasri2307,项目名称:erasoft_mtc,代码行数:7,代码来源:CustomHelper.php

示例7: auth

 public function auth(\Illuminate\Routing\Route $route, $request)
 {
     $action = explode('@', $route->getActionName());
     $whiteList = ['showLogin', 'loginAction', 'logoutAction'];
     if (\Session::get('cmslogin') == null && !in_array($action[1], $whiteList)) {
         return \Redirect::to('/' . _LCMS_PREFIX_ . '/login');
     }
 }
开发者ID:ksp-media,项目名称:laikacms,代码行数:8,代码来源:BaseController.php

示例8: updateInstances

 /**
  * Update the route and request instances
  *
  * @param Route   $route
  * @param Request $request
  */
 public function updateInstances($route, $request)
 {
     $this->request = $request;
     if ($request) {
         $this->uri = urldecode($request->path());
     }
     $this->route = $route;
     if ($route) {
         $this->action = $route->getActionName();
         $actionSegments = Str::parseCallback($this->action, null);
         $this->controller = head($actionSegments);
         $this->method = last($actionSegments);
     }
 }
开发者ID:yinniermei,项目名称:active,代码行数:20,代码来源:Active.php

示例9: getRouteInformation

 /**
  * Get the route information for a given route.
  *
  * @param \Illuminate\Routing\Route $route        	
  * @return array
  */
 protected function getRouteInformation(Route $route)
 {
     return $this->filterRoute(['host' => $route->domain(), 'method' => implode('|', $route->methods()), 'uri' => $route->uri(), 'name' => $route->getName(), 'action' => $route->getActionName(), 'middleware' => $this->getMiddleware($route)]);
 }
开发者ID:ngitimfoyo,项目名称:Nyari-AppPHP,代码行数:10,代码来源:RouteListCommand.php

示例10: getMiddleware

 /**
  * Get before filters.
  *
  * @param  \Illuminate\Routing\Route  $route
  * @return string
  */
 protected function getMiddleware($route)
 {
     $middlewares = array_values($route->middleware());
     $actionName = $route->getActionName();
     if (!empty($actionName) && $actionName !== 'Closure') {
         $middlewares = array_merge($middlewares, $this->getControllerMiddleware($actionName));
     }
     return implode(',', $middlewares);
 }
开发者ID:davidhemphill,项目名称:framework,代码行数:15,代码来源:RouteListCommand.php

示例11: getRouteInformation

 /**
  * Get the route information for a given route.
  *
  * @param  string  $name
  * @param  \Illuminate\Routing\Route  $route
  * @return array
  */
 protected function getRouteInformation(Route $route)
 {
     $uri = implode('|', $route->methods()) . ' ' . $route->uri();
     return $this->filterRoute(array('host' => $route->domain(), 'uri' => $uri, 'name' => $route->getName(), 'action' => $route->getActionName(), 'prefix' => $route->getPrefix(), 'method' => $route->methods()[0]));
 }
开发者ID:f2m2,项目名称:apidocs,代码行数:12,代码来源:ApiDocsGenerator.php

示例12: getRouteInformation

 /**
  * Get the route information for a given route.
  *
  * @param  \Illuminate\Routing\Route $route
  * @return array
  */
 protected function getRouteInformation(Route $route)
 {
     list($controller, $action) = explode("@", $route->getActionName());
     return ['host' => $route->domain(), 'method' => implode('|', $route->methods()), 'uri' => $route->uri(), 'name' => $route->getName(), 'controller' => $controller, 'action' => $action, 'resource' => $route->getActionName(), 'middleware' => Collection::make($this->getMiddleware($route))];
 }
开发者ID:aginev,项目名称:acl,代码行数:11,代码来源:RouteList.php

示例13: getRouteInformation

 /**
  * @param Route $route
  *
  * @return array
  */
 protected function getRouteInformation(Route $route)
 {
     return ['method' => implode('|', $route->methods()), 'uri' => $route->uri(), 'name' => $route->getName(), 'action' => $route->getActionName()];
 }
开发者ID:laravel-jp-reference,项目名称:chapter8,代码行数:9,代码来源:RouteService.php

示例14: evaluateTemplated

 /**
  * @param Route $route
  * @param UrlGenerator $urlGenerator
  * @param $queryString
  * @return bool
  */
 private static function evaluateTemplated(Route $route, UrlGenerator $urlGenerator, $queryString)
 {
     // Does the route have named parameters? http://example.com/users/{users}
     if (count($route->parameterNames())) {
         return true;
     }
     $url = rawurldecode($urlGenerator->action($route->getActionName()));
     // Does the route's URI already contain a query string? http://example.com/users?page={page}&per_page={per_page}
     if (preg_match('/\\?.*=\\{.*?\\}/', $url)) {
         return true;
     }
     // Does the query string contain any parameters?
     if (preg_match('/\\?.*=\\{.*?\\}/', $queryString)) {
         return true;
     }
     return false;
 }
开发者ID:jarischaefer,项目名称:hal-api,代码行数:23,代码来源:HalApiLinkImpl.php

示例15: getRouteInformation

 protected function getRouteInformation(Route $route, $current)
 {
     $uri = implode(' | ', $route->methods()) . ' <a href="' . $this->url->to($route->uri()) . '">' . $route->uri() . '</a>';
     return array('current' => $current == $route, 'host' => $route->domain(), 'uri' => $uri, 'name' => $route->getName(), 'action' => $route->getActionName(), 'before' => $this->getBeforeFilters($route), 'after' => $this->getAfterFilters($route));
 }
开发者ID:onigoetz,项目名称:profiler,代码行数:5,代码来源:Router41DataCollector.php


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