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