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


PHP Routing\Route类代码示例

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


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

示例1: addLookups

 /**
  * Add the route to any look-up tables if necessary.
  *
  * @param  Route $route illuminate route
  *
  * @return void
  */
 protected function addLookups($route)
 {
     // If the route has a name, we will add it to the name look-up table so that we
     // will quickly be able to find any route associate with a name and not have
     // to iterate through every route every time we need to perform a look-up.
     $action = $route->getAction();
     if (isset($action['as'])) {
         if (isset($action['module'])) {
             $this->nameList[$action['module'] . "." . $action['as']] = $route;
         } else {
             $this->nameList[$action['as']] = $route;
         }
     }
     // When the route is routing to a controller we will also store the action that
     // is used by the route. This will let us reverse route to controllers while
     // processing a request and easily generate URLs to the given controllers.
     if (isset($action['controller'])) {
         $this->addToActionList($action, $route);
     }
     if (isset($action['module'])) {
         $this->addToModuleList($action, $route);
     }
     if (isset($action['settings_menu'])) {
         $this->addToSettingsMenuList($route);
     }
 }
开发者ID:mint-soft-com,项目名称:xpressengine,代码行数:33,代码来源:RouteCollection.php

示例2: setRoute

 /**
  * @param RouteInstance $route
  */
 public function setRoute(RouteInstance $route)
 {
     // Compile route
     $request = new Request();
     $route->matches($request);
     $this->route = $route;
 }
开发者ID:anahkiasen,项目名称:janitor,代码行数:10,代码来源:Route.php

示例3: matches

 /**
  * Validate a given rule against a route and request.
  *
  * @param  \Illuminate\Routing\Route  $route
  * @param  \Illuminate\Http\Request  $request
  * @return bool
  */
 public function matches(Route $route, Request $request)
 {
     if (is_null($route->hostExpression())) {
         return true;
     }
     return preg_match($route->hostExpression(), $request->getHost());
 }
开发者ID:allapo,项目名称:to-do-list,代码行数:14,代码来源:HostValidator.php

示例4: find

 public function find(Route $route)
 {
     $manuales = manuales::find($route->getParameter('manuales'));
     if (!$manuales) {
         abort(404);
     }
 }
开发者ID:veronico12,项目名称:aplicacion,代码行数:7,代码来源:ManualesControlador.php

示例5: getControllerName

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

示例6: matches

 /**
  * Validate a given rule against a route and request.
  *
  * @param BaseRoute $route
  * @param Request $request
  * @return bool
  */
 public function matches(BaseRoute $route, Request $request)
 {
     if (!$route instanceof Route) {
         return false;
     }
     return $route->getIntent() === (new Interpreter($request, $route->getWsdl()))->getIntent();
 }
开发者ID:bogdananton,项目名称:multi-routing,代码行数:14,代码来源:IntentValidator.php

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

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

示例9: matches

 /**
  * Validate a given rule against a route and request.
  *
  * @param  \Illuminate\Routing\Route $route
  * @param  \Illuminate\Http\Request $request
  * @return bool
  */
 public function matches(Route $route, Request $request)
 {
     if (is_null($route->getCompiled()->getHostRegex())) {
         return true;
     }
     return preg_match($route->getCompiled()->getHostRegex(), $request->getHost());
 }
开发者ID:saj696,项目名称:pipe,代码行数:14,代码来源:HostValidator.php

示例10: __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

示例11: addParentIdsConditionsForDbObjectInjection

 /**
  * @param Route $route
  * @param CmfDbObject $object
  * @param array $conditions
  */
 protected function addParentIdsConditionsForDbObjectInjection(Route $route, CmfDbObject $object, array &$conditions)
 {
     foreach ($route->parameterNames() as $name) {
         if ($object->_hasField($name)) {
             $conditions[$name] = $route->parameter($name);
         }
     }
 }
开发者ID:swayok,项目名称:PeskyCMF,代码行数:13,代码来源:InjectsDbObjects.php

示例12: findObservationFormatUser

 /**
  * Find the ObservationFormatUser or App Abort 404.
  */
 public function findObservationFormatUser(Route $route)
 {
     $this->observation = ObservationFormatUser::findOrFail($route->getParameter('doit'));
     $this->observation->load('answers.question');
     $this->observation->answers = $this->observation->answers->sortBy(function ($answer, $key) {
         return $answer->question->order;
     });
 }
开发者ID:andrestntx,项目名称:Education,代码行数:11,代码来源:ObservationsController.php

示例13: extractPermissionFrom

 /**
  * Extracts the permission configured inside the route action array.
  *
  * @param Route $route
  * @return string|null
  */
 private function extractPermissionFrom(Route $route)
 {
     $parameters = $route->getAction();
     if (isset($parameters['permission'])) {
         return $parameters['permission'];
     }
     return null;
 }
开发者ID:digbang,项目名称:security,代码行数:14,代码来源:RoutePermissionRepository.php

示例14: dispatch

 /**
  * Dispatch a request to a given controller and method.
  *
  * @param  \Illuminate\Routing\Route  $route
  * @param  mixed  $controller
  * @param  string  $method
  * @return mixed
  */
 public function dispatch(Route $route, $controller, $method)
 {
     $parameters = $this->resolveClassMethodDependencies($route->parametersWithoutNulls(), $controller, $method);
     if (method_exists($controller, 'callAction')) {
         return $controller->callAction($method, $parameters);
     }
     return call_user_func_array([$controller, $method], $parameters);
 }
开发者ID:delatbabel,项目名称:framework,代码行数:16,代码来源:ControllerDispatcher.php

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


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