• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Routing\Route类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: handle

 /**
  * Handle the command.
  *
  * @param RedirectRepositoryInterface $redirects
  * @param Redirector                  $redirector
  * @param Parser                      $parser
  * @param Route                       $route
  * @return \Illuminate\Http\RedirectResponse
  */
 public function handle(RedirectRepositoryInterface $redirects, Redirector $redirector, Parser $parser, Route $route)
 {
     $redirect = $redirects->find($this->id);
     $parameters = array_merge(array_map(function () {
         return null;
     }, array_flip($route->parameterNames())), $route->parameters());
     return $redirector->to($parser->parse($redirect->getTo(), $parameters), $redirect->getStatus(), [], $redirect->isSecure());
 }
开发者ID:AkibaTech,项目名称:redirects-module,代码行数:17,代码来源:GetRedirectResponse.php


示例17: addToCollections

 /**
  * Add the given route to the arrays of routes.
  *
  * @param  \Illuminate\Routing\Route $route
  * @return void
  */
 protected function addToCollections($route)
 {
     $domainAndUri = $route->domain() . $route->getUri() . $route->getPriority();
     foreach ($route->methods() as $method) {
         $this->routes[$method][$domainAndUri] = $route;
     }
     $this->allRoutes[$method . $domainAndUri] = $route;
 }
开发者ID:langaner,项目名称:route-priority,代码行数:14,代码来源:RouteCollection.php


示例18: findChecklist

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


示例19: validateShowPath

 /**
  * Validates show path.
  * @param Route $route
  * @return Response
  */
 public function validateShowPath(Route $route)
 {
     $org = $route->getParameter('organisations');
     $attr = $route->getParameter('attrs');
     if ($attr->organisation_id !== $org->id) {
         return Response::json(null, 404);
     }
 }
开发者ID:ryansmith94,项目名称:laradash,代码行数:13,代码来源:AttrsController.php


示例20: getPatternFilters

 /**
  * Get all of the pattern filters matching the route.
  *
  * @param  \Illuminate\Routing\Route $route
  * @return array
  */
 protected function getPatternFilters($route)
 {
     $patterns = array();
     foreach ($route->getMethods() as $method) {
         $inner = $this->router->findPatternFilters($method, $route->getPath());
         $patterns = array_merge($patterns, $inner);
     }
     return $patterns;
 }
开发者ID:arizawan,项目名称:livetvwithyoutube,代码行数:15,代码来源:SymfonyRouteCollector.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Routing\RouteCollection类代码示例发布时间:2022-05-23
下一篇:
PHP Routing\ResponseFactory类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap