public function handle(Request $request, Closure $next)
    {
        $request::setTrustedProxies([$request->getClientIp()]);

        if (config('redirect.https', false) && !$request->secure())
        {
            return redirect()->secure($request->getRequestUri());
        }

        return $next($request);
    }
public function handle(Request $request, Closure $next)
    {
        $request::setTrustedProxies([$request->getClientIp()]);

        if (config('redirect.https', false) && !$request->secure())
        {
            return redirect()->secure($request->getRequestUri());
        }

        return $next($request);
    }
public function handle ( Request $ request , Closure $ next ) { $ request :: setTrustedProxies ( [ $ request -> getClientIp ( ) ] ) ; if ( config ( 'redirect.https' , false ) && ! $ request -> secure ( ) ) { return redirect ( ) -> secure ( $ request -> getRequestUri ( ) ) ; } return $ next ( $ request ) ; }
Automatic redirect on cloudFlare

@param Request $request
@param Closure $next

@return \Illuminate\Http\RedirectResponse|mixed

@throws \InvalidArgumentException
Automatic redirect on cloudFlare