Handle an incoming request.

@param  \Illuminate\Http\Request $request
@param  \Closure $next
@return mixed
8249
public function handle($request, Closure $next)
    {
        $request->merge($request->xml(true));
        
        return $next($request);
    }
676365
public function handle(Request $request, Closure $next)
    {
        if ($request->ajax() || $request->wantsJson()) {
            return $next($request);
        }

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

        return $next($request);
    }
22310
public function handle($request, Closure $next)
    {
        if ($this->sessionConfigured()) {
            $request->setLaravelSession($this->startSession($request));
        }

        return $next($request);
    }
36178
public function handle($request, Closure $next)
    {
        $this->core->menu()->initialize();

        return $next($request);
    }
1138999
public function handle($request, Closure $next)
    {
        if (! $this->isCorsRequest($request)) {
            return $next($request);
        }

        $this->corsProfile->setRequest($request);

        if (! $this->corsProfile->isAllowed()) {
            return $this->forbiddenResponse();
        }

        if ($this->isPreflightRequest($request)) {
            return $this->handlePreflightRequest();
        }

        $response = $next($request);

        return $this->corsProfile->addCorsHeaders($response);
    }
462069
public function handle($request, Closure $next)
    {
        $token = $this->getTokenFromRequest($request);
        $this->jwt->setToken($token)->validateOrFail();

        return $next($request);
    }
801350
public function handle($request, Closure $next)
    {
        $this->attributes = array_slice(func_get_args(), 2);

        $this->clean($request);

        return $next($request);
    }
95532
public function handle($request, Closure $next)
    {
        return $next($request)
            ->header('Access-Control-Allow-Origin', '*')
            ->header('Access-Control-Allow-Methods', 'POST, OPTIONS, PUT, PATCH, DELETE')
            ->header('Access-Control-Allow-Credentials', 'true')
            ->header('Access-Control-Max-Age', '10000')
            ->header('Access-Control-Allow-Headers', 'Content-Type, Authorization, X-Requested-With');
    }
52718
public function handle($request, Closure $next)
    {
        $response = $next($request);

        if ($response instanceof Response) {
            $response->isNotModified($request);
        }

        return $response;
    }
637419
public function handle($request, Closure $next)
    {
        $route  = $this->container->make(Route::class);
        $binder = $this->container->make(RouteBinderRegister::class);

        $binder->substituteBindings($route);

        return $next($request);
    }
224119
public function handle($request, \Closure $next)
    {
        if ($request->expectsJson()) {
            return $next($request);
        }

        return json_response()->error([
            'message' => 'Invalid AJAX Request',
        ], $this->code);
    }
1196279
public function handle($request, Closure $next)
    {
        if ($request->method() != 'GET') {

            /** @var \Approached\LaravelImageOptimizer\ImageOptimizer $imageOptimizer */
            $imageOptimizer = app('Approached\LaravelImageOptimizer\ImageOptimizer');

            foreach ($request->allFiles() as $one) {
                if (is_array($one)) {
                    foreach ($one as $file) {
                        if ($this->isImageFile($file)) {
                            $imageOptimizer->optimizeUploadedImageFile($file);
                        }
                    }
                } else {
                    if ($this->isImageFile($one)) {
                        $imageOptimizer->optimizeUploadedImageFile($one);
                    }
                }
            }
        }

        return $next($request);
    }
873539
public function handle(Request $request, \Closure $next)
	{
		$this->buildRepository($request);

		return $next($request);
	}
4140
public function handle($request, Closure $next)
    {
        if (! $this->checkIfUserCanViewPost($request)) {
            return redirect()->route('/');
        }

        return $next($request);
    }
464288
public function handle(Request $request, Closure $next)
    {
        // If the request URL is ignored from localization.
        if ($this->shouldIgnore($request)) return $next($request);

        $this->localization->setRouteNameFromRequest($request);

        return $next($request);
    }
662209
public function handle($request, Closure $next)
    {
        if (env('APP_ENV') !== 'testing') {
            header('Access-Control-Allow-Origin: *');
            header('Access-Control-Allow-Credentials: true');
            header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS');
            header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, Authorization, token, _');
            header('Content-Type: application/json; charset=utf-8');
        }

        if ($request->getRealMethod() == 'OPTIONS') {
            return new \Illuminate\Http\Response('OK', 200);
        }

        return $next($request);
    }