Handle an incoming request.

@param Request  $request
@param \Closure $next

@return mixed
344279
public function handle($request, Closure $next)
    {
        if (!$request->secure()) {
            $errorMessage = trans('LaravelHttps::laravel-https.messages.httpsRequredError').trans('LaravelHttps::laravel-https.messages.httpsRequred');
            $errorCode = config('LaravelHttps.httpsAccessDeniedErrorCode');

            if ($request->ajax() || $request->wantsJson()) {
                return Response::json([
                    'code'      => $errorCode,
                    'message'   => $errorMessage,
                ], $errorCode);
            }

            try {
                return response()->view('LaravelHttps::errors.'.$errorCode);
            } catch (Exception $e) {
                \App::abort($errorCode, $errorMessage);
            }
        }

        return $next($request);
    }
1253502
public function handle(Request $request, Closure $next)
    {
        /** @var Response $response */
        $response = $request->isXmlHttpRequest() === true ? $next($request) : $this->createForbiddenResponse();

        return $response;
    }
611914
public function handle($request, Closure $next)
    {
        $paginationKey = config('pagination.key');

        $request->offsetSet($paginationKey, $request->paginationCount());

        return $next($request);
    }
41077
public function handle($request, Closure $next)
    {
        config(['request.timezone' => $this->determineRequestTimezone($request)]);

        return $next($request);
    }
463485
public function handle($request, \Closure $next)
    {
        $route = $request->route();

        if ($route->hasCondition()) {
            $this->router->addWordPressBindings($route);
        }

        return $next($request);
    }
552989
public function handle($request, Closure $next)
    {

        $request = $this->requestConverter->toCmsRequest($request);

        $request->provideCmsPath(function($request){
            $this->attachCmsPath($request);
        });

        $this->injectRequest($request);

        $this->app['events']->fire($this->requestEventName,[$request, $this]);

        return $next($request);

    }
1027237
public function handle($request, Closure $next)
    {
        $locale = $this->localizer->detect();

        if ($locale) {
            $this->localizer->store($locale);
        }

        return $next($request);
    }
1092459
public function handle($request, Closure $next)
    {
        $locale = $request->segment(1);

        $language = Language::findByCode($locale);

        if ($language) {
            App::setLocale($language->code);
            $request->setDefaultLocale($language->code);
        } else {
            $request->setDefaultLocale(config('app.locale'));
        }

        return $next($request);
    }
1231658
public function handle($request, Closure $next)
    {
        $this->authorizer->setRequest($request);

        $this->authorizer->checkAuthCodeRequest();

        return $next($request);
    }
482879
public function handle($request, Closure $next)
    {
        if (auth()->guest() || !user()->hasRoles(['client', 'member'])) {
            return $next($request);
        }
        $this->beforeSendingThroughPipeline();
        $response = $next($request);
        $this->afterSendingThroughPipeline();

        return $response;
    }
929465
public function handle($request, Closure $next)
    {
        Paginator::currentPageResolver(function () {
            return app('paginateroute')->currentPage();
        });

        return $next($request);
    }
491144
public function handle(Request $request, Closure $next)
    {

        $fields = array_slice(func_get_args(), 2);

        foreach ($fields as $field) {
            $hiddenField = '_'.$field;
            if ($request->has($hiddenField)) {
                $request->merge([$field => $this->formatDate($request->get($hiddenField))]);
            }
        }

        return $next($request);
    }
729059
public function handle($request, Closure $next)
    {
        $acceptLanguage = $request->header('Accept-Language');
        $locale = $this->getLocale($acceptLanguage);
        \App::setLocale($locale);
        return $next($request);
    }
1235603
public function handle($request, Closure $next)
    {
        if (!Gate::allows('access', $request)) {
            return response('Forbidden (No Access)', 403);
        }
        return $next($request);
    }
1304649
public function handle($request, Closure $next)
    {
        $modelName = $request->route()->parameter('model');

        app()->singleton('itemconfig', function ($app) use ($modelName) {
            $configFactory = app('admin_config_factory');

            return $configFactory->make($modelName, true);
        });

        return $next($request);
    }
166804
public function handle(Request $request, Closure $next)
    {
        $request->attributes->add(['responsecache.doNotCache' => true]);

        return $next($request);
    }
257664
public function handle(Request $request, \Closure $next) {
        if ($request->getMethod() == 'OPTIONS') {
            $response = new Response("", 200);
        }
        else {
            try{
                $response = $next($request);
            }catch(\Exception $e){
                $response = $this->exceptionRenderer->render($e);
            }
        }
        $this->setCorsHeaders($request, $response);
        return $response;
    }