src/Http/Middleware/Request.php
protected function getRequestIp($request)
    {
        if ($request->server('HTTP_CF_CONNECTING_IP')) {
            // cloudflare
            return $request->server('HTTP_CF_CONNECTING_IP');
        }

        if ($request->server('X_FORWARDED_FOR')) {
            // forwarded proxy
            return $request->server('X_FORWARDED_FOR');
        }

        if ($request->server('REMOTE_ADDR')) {
            // remote header
            return $request->server('REMOTE_ADDR');
        }
    }
protected function getRequestIp($request)
    {
        if ($request->server('HTTP_CF_CONNECTING_IP')) {
            // cloudflare
            return $request->server('HTTP_CF_CONNECTING_IP');
        }

        if ($request->server('X_FORWARDED_FOR')) {
            // forwarded proxy
            return $request->server('X_FORWARDED_FOR');
        }

        if ($request->server('REMOTE_ADDR')) {
            // remote header
            return $request->server('REMOTE_ADDR');
        }
    }
protected function getRequestIp ( $ request ) { if ( $ request -> server ( 'HTTP_CF_CONNECTING_IP' ) ) { // cloudflare return $ request -> server ( 'HTTP_CF_CONNECTING_IP' ) ; } if ( $ request -> server ( 'X_FORWARDED_FOR' ) ) { // forwarded proxy return $ request -> server ( 'X_FORWARDED_FOR' ) ; } if ( $ request -> server ( 'REMOTE_ADDR' ) ) { // remote header return $ request -> server ( 'REMOTE_ADDR' ) ; } }
Get ip from different request headers.

@param $request

@return mixed
Get ip from different request headers .