Get an onion layer function.
This function will get the object from a previous layer and pass it inwards
@param  LayerInterface $nextLayer
@param  LayerInterface $layer
@return Closure
8466
private function createLayer($nextLayer, $layer)
    {
        return function($object) use($nextLayer, $layer){
            return $layer->peel($object, $nextLayer);
        };
    }
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;
    }
758263
public void removeLayerFromCache(LayerImpl layer) {
		if (layer.getId() != layerId) {
			throw new IllegalStateException();
		}
		LayerCacheImpl layerCache = layerCacheRef.get();
		if (layerCache != null) {
			layerCache.remove(layer.getKey(), layer);
		}
	}
702526
public function handle($request, Closure $next)
    {
        $request->setTrustedProxies([
            $request->getClientIp(),
        ]);

        if (!$request->secure() && app()->environment('production')) {
                return redirect()->secure($request->getRequestUri());
        }

        return $next($request);
    }
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);
    }
776169
public function handle($request, Closure $next)
    {
        $route = $request->route();

        $this->router->substituteBindings($route);

        $this->substituteImplicitBindings($route);

        return $next($request);
    }
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);
    }
842551
protected static function stringToInt(RuleInterface $next = null): RuleInterface
    {
        return $next === null ? new StringToInt() : new AndOperator(new StringToInt(), $next);
    }
462506
public function handle($request, HandlerInterface $next)
    {
        if ($this->isEmpty()) {
            return $request;
        }
        if ($this->shadow == false) {
            $bundle = clone $this;
            $bundle->store->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO | SplDoublyLinkedList::IT_MODE_DELETE);
            $this->shadow = true;

            return $next->handle($request, $bundle);
        }
        $handler = $this->frontPop();

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

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

        return $next($request);

    }
1007803
public function next(Request $request)
	{
		// Update the stack position
		$this->position++;

		// Get the next layer
		$layer = $this->layers[$this->position];

		// Call handle on next layer
		return $layer->handle($request);
	}
582320
public function handle($request, Closure $next)
    {

        if (!$request->isSecure() and env('SECURE_COOKIE', false)) {
            if (strpos($request->getRequestUri(), '/storage/') === false) {
                return redirect()->secure($request->getRequestUri());
            }

        }

        return $next($request);
    }
6800
public static function roleId(RuleInterface $next = null): RuleInterface
    {
        return self::asSanitizedString(self::readable(RolesApi::class, $next));
    }
889821
public function handle($request, Closure $next)
    {
        if (! $this->xray->isEnabled()) {
            return $next($request);
        }

        $this->xray->boot();

        /** @var \Illuminate\Http\Response $response */
        $response = $next($request);

        if ($response->isRedirection()) {
            return $response;
        } elseif (
            ($response->headers->has('Content-Type') &&
                strpos($response->headers->get('Content-Type'), 'html') === false)
            || $request->getRequestFormat() !== 'html'
            || $response->getContent() === false
        ) {
            return $response;
        } elseif (is_null($response->exception) && !is_null($this->xray->getBaseView())) {
            // Modify the response to add the Debugbar
            $this->injectXrayBar($response);
        }
        return $response;
    }
831466
public function extractFromPath(Closure $next) {
		$locale = $this->request->getUrlParam('locale');
		if ($this->translation->hasLocale($locale)) {
			$this->translation->setLocale($locale);
			$next();
		} else {
			$this->notFound();
		}
	}
397385
public function handle($request, Closure $next)
    {
        $menu = new AdminMenuBuilder();
        View::share('top_menu', $menu->topMenu());

        return $next($request);
    }