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


PHP Container::boot方法代码示例

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


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

示例1: handle

 /**
  * Handle a given request and return the response.
  *
  * @param  \Symfony\Component\HttpFoundation\Request  $request
  * @param  int  $type
  * @param  bool  $catch
  * @return \Symfony\Component\HttpFoundation\Response
  * @throws \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException
  */
 public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
 {
     // Our middleware needs to ensure that Laravel is booted before we
     // can do anything. This gives us access to all the booted
     // service providers and other container bindings.
     $this->container->boot();
     if ($request instanceof InternalRequest || $this->auth->user()) {
         return $this->app->handle($request, $type, $catch);
     }
     // If a collection exists for the request and we can match a route
     // from the request then we'll check to see if the route is
     // protected and, if it is, we'll attempt to authenticate.
     if ($this->router->requestTargettingApi($request) && ($collection = $this->getApiRouteCollection($request))) {
         try {
             $route = $this->controllerReviser->revise($collection->match($request));
             if ($this->routeIsProtected($route)) {
                 return $this->authenticate($request, $route) ?: $this->app->handle($request, $type, $catch);
             }
         } catch (HttpExceptionInterface $exception) {
             // If we catch an HTTP exception then we'll simply let
             // the wrapping kernel do its thing.
         }
     }
     return $this->app->handle($request, $type, $catch);
 }
开发者ID:iwillhappy1314,项目名称:laravel-admin,代码行数:34,代码来源:Authentication.php

示例2: handle

 /**
  * Handle a given request and return the response.
  *
  * @param  \Symfony\Component\HttpFoundation\Request  $request
  * @param  int  $type
  * @param  bool  $catch
  * @return \Symfony\Component\HttpFoundation\Response
  * @throws \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException
  */
 public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
 {
     $this->container->boot();
     $this->prepareConfig($request);
     // Internal requests as well as requests that are not targetting the
     // API will not be rate limited. We'll also be sure not to perform
     // any rate limiting if it has been disabled.
     if ($request instanceof InternalRequest or !$this->router->requestTargettingApi($request) or $this->rateLimitingDisabled()) {
         return $this->app->handle($request, $type, $catch);
     }
     $this->cache->add($this->config['keys']['requests'], 0, $this->config['reset']);
     $this->cache->add($this->config['keys']['reset'], time() + $this->config['reset'] * 60, $this->config['reset']);
     $this->cache->increment($this->config['keys']['requests']);
     if ($this->exceededRateLimit()) {
         list($version, $format) = $this->router->parseAcceptHeader($request);
         $response = (new Response(['message' => $this->config['exceeded']], 403))->morph($format);
     } else {
         $response = $this->app->handle($request, $type, $catch);
     }
     return $this->adjustResponseHeaders($response);
 }
开发者ID:iwillhappy1314,项目名称:laravel-admin,代码行数:30,代码来源:RateLimit.php


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