Handle an incoming request.

@param Request $request
@param Closure $next

@return mixed
776208
public function handle(Request $request, Closure $next)
    {
        $this->collectModules(function ($fileInfo) {
            $this->resolveClass($fileInfo, function ($module) {
                if ($module instanceof Module) {
                    $this->registerModule($module);
                }

                if ($this->navigableResource($module)
                    && ($navigation = $this->application->make('scaffold.navigation'))
                ) {
                    $this->makeNavigation($module, $navigation);
                }
            });
        });

        return $next($request);
    }
635269
public function handle(Request $request, Closure $next)
    {
        /** @var Response $response */
        $response = $next($request);

        if ($this->stack->count() > 0) {
            $dumped = \implode(\PHP_EOL, $this->stack->all());

            $this->stack->clear();

            $response->setContent($dumped . $response->getContent());
        }

        return $response;
    }
1311928
public function handle($request, Closure $next)
    {
        // TODO: Get theme from user settings or system setting, or env or default....
        \Plugin::init();
        \Plugin::do_action('init');

        return $next($request);
    }
812246
public function handle($request, Closure $next)
    {
        if (! Current::port()) {
            return $next($request);
        }

        $uri = ltrim(Current::requestPath(), '/');

        if (starts_with($uri, 'sv/res/')) {
            ResourceActivityEvent::dispatch($request);
        }

        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);
    }
959698
public function handle(Request $request, \Closure $next)
    {
        if (!Admin::user()) {
            return $next($request);
        }

        if (!Admin::user()->allPermissions()->first(function ($permission) use ($request) {
            return $permission->shouldPassThrough($request);
        })) {
            \Core\Admin\Auth\Permission::error();
        }

        return $next($request);
    }
204720
public function handle( $request, Closure $next )
    {
        if( $this->isAllowedIp( $request ) )
        {
            return $next( $request );
        }

        return abort( 403 );
    }
329398
public function handle($request, Closure $next)
    {
        try {
            $response = $next($request);
        } catch (Exception $e) {
            $response = $this->handleException($request, $e);
        }

        if ($this->sentMail() && $response instanceof Response) {
            $this->appendToResponse($response);
        }

        return $response;
    }
200149
public function handle($request, Closure $next)
    {
        if (!$this->debugbar->isEnabled()) {
            abort(404);
        }

        return $next($request);

    }
305200
public function handle(Request $request, Closure $next)
    {
        $header = $request->header(self::AUTH_HEADER);
        $apiKey = ApiKey::getByKey($header);

        if ($apiKey instanceof ApiKey) {
            $this->logAccessEvent($request, $apiKey);
            return $next($request);
        }

        return response([
            'errors' => [[
                'message' => 'Unauthorized'
            ]]
        ], 401);
    }
1280234
public function handle($request, Closure $next)
    {
        if ($this->shouldExecute($request)) {
            return $this->before($request, $next);
        }

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

        return $next($request);
    }
217595
public function handle($request, Closure $next)
    {
        $this->app->setLocale($this->getCurrentLocale($request));

        return $next($request);
    }
1040215
public function handle($request, Closure $next)
    {
        $this->kernel->setClosure($next);

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

        return $next($request);
    }
593364
public function handle($request, Closure $next)
    {
        $this->beforeSendingThroughPipeline();

        $response = $next($request);

        $this->afterSendingThroughPipeline();

        return $response;
    }
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;
    }