jamesmills / laravel-timezone

Enable user Timezones in your application.
MIT License
677 stars 91 forks source link

Take the first found IP from 'lookup' config key #79

Open boryn opened 2 years ago

boryn commented 2 years ago

At this moment, if IP is not found, the loop skips but eventually the last resolved IP is taken.

IMHO it should be the first IP grabbed, for example I'd like to get real user IP from cloudflare using this code:

'lookup' => [
        'server' => [
            'HTTP_CF_CONNECTING_IP',
            'REMOTE_ADDR',
        ],
        'headers' => [

        ],
    ],

Now, I need to use 'HTTP_CF_CONNECTING_IP' as the last option which is not intuitive, and we unnecessarily loop through all the items.

Solves: https://github.com/jamesmills/laravel-timezone/issues/78