@param Request  $request
@param callable $next

@return mixed
973868
public function handle(Request $request, callable $next)
    {
        $response = $next($request);

        if ( !$response instanceof Redirect ) {
            return $response;
        }

        $url = $this->router->routeNameToUrlString(
            $response->getRouteName(),
            $response->getParams()
        );

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

		return $next($request);
	}
1050465
public function handle(Request $request, Closure $next)
    {
        $response = $next($request);

        $headers = (new SecureHeaders(config('secure-headers', [])))->headers();

        foreach ($headers as $key => $value) {
            $response->headers->set($key, $value, true);
        }

        return $response;
    }
299532
public function handle(Request $request, callable $next)
    {
        $self = $this;
        set_error_handler(
            function ($errorNumber, $errorString, $errorFile, $errorLine) use ($self) {
                $self->error = $this->getTemplate(
                    $errorNumber,
                    $errorString,
                    $errorFile,
                    $errorLine
                );
                throw new \Exception($errorString, $errorLine);
            }
        );

        try {
            $response = $next($request);
            if ( $this->error ) {
                return $this->showErrorResponse(
                    $this->error
                );
            }
            if ( !$response ) {
                return $this->showErrorResponse(
                    $this->getTemplate(
                        new \Exception('No response returned from the middlewares pipe')
                    )
                );
            }

            if ( !$response instanceof Response ) {
                return $this->showErrorResponse(
                    $this->getTemplate(
                        new \Exception(
                            sprintf(
                                'Response type "%s" is not of type Symfony\Component\HttpFoundation\Response',
                                is_object($response) ?
                                    get_class($response) :
                                    (
                                    is_array($response) ?
                                        'Array' :
                                        (
                                        is_string($response) ?
                                            'String' :
                                            '(Unknown Type)'
                                        )
                                    )
                            )
                        )
                    )
                );
            }
        } catch (\Exception $exception) {
            if ( $this->error ) {
                return $this->showErrorResponse(
                    $this->error
                );
            }

            return $this->showErrorResponse(
                $this->getTemplate(
                    $exception
                )
            );
        }

        return $response;
    }
52718
public function handle($request, Closure $next)
    {
        $response = $next($request);

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

        return $response;
    }
362388
public function handle($request, Closure $next)
    {
        if ($this->auth->check() && $this->auth->user()->hasAccess($this->routeActive)) {
            return $next($request);
        } else {
            abort(404);
        }
    }
1306936
public function handle($request, Closure $next)
    {
        if ($this->auth->parser()->setRequest($request)->hasToken()) {
            try {
                $this->auth->parseToken()->authenticate();
            } catch (Exception $e) {
                //
            }
        }

        return $next($request);
    }
774439
public function process(Request $request, callable $next)
    {
        foreach ($this->preventOn() as $url) {
            if ($request->is($url)) {
                return $next($request);
            }
        }

        if ($request->isAjax()) {
            if ($request->getHeader('x-csrf-token') === session('_token')) {
                return $next($request);
            }

            response()->status(401);

            return response()->send('unauthorize.');
        }

        if ($request->get('_token') == $request->session()->get('_token')) {
            return $next($request);
        }

        throw new TokenMismatch('Token Mismatch');
    }
200149
public function handle($request, Closure $next)
    {
        if (!$this->debugbar->isEnabled()) {
            abort(404);
        }

        return $next($request);

    }
1129004
public function handleRequest(RequestInterface $request, callable $next, callable $first)
    {
        return $next($request)->then(function (ResponseInterface $response) {
            $status = $response->getStatusCode();

            if ($status >= 400 && $status < 600) {
                self::handleError($status, self::getMessage($response) ?: $response->getReasonPhrase());
            }

            return $response;
        });
    }
995406
public function handle($request, Closure $next)
    {
        if ( ! $this->auth->check()) {
            return cms_api()->response('Unauthorized.', 401);
        }

        return $next($request);
    }
1054986
public function handle($request, Closure $next)
    {
        $this->credentials->getThrottleProvider()->enable();

        return $next($request);
    }
953052
public function handle($request, Closure $next)
    {
        $locale = \LocaleHelper::getLocale();
        app()->setLocale($locale);

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

        return $response;
    }
603681
public function handle(Request $request, Closure $next)
    {
        if (!$this->verificationService->mustBeVerified($request->route(), $this->guard)) {
            return $next($request);
        }

        if ($request->ajax()) {
            return response('Unauthorized.', 401);
        }

        return redirect()->to($this->verificationService->getPathToVerificationAction());
    }
294911
protected function handleRequest(callable $next)
    {
        $this->route($this->request);
        return $next($this->request, $this->response);
    }
1235603
public function handle($request, Closure $next)
    {
        if (!Gate::allows('access', $request)) {
            return response('Forbidden (No Access)', 403);
        }
        return $next($request);
    }