laravel-timezone icon indicating copy to clipboard operation
laravel-timezone copied to clipboard

The library does not take the first found IP from 'lookup' config key

Open boryn opened this issue 3 years ago • 1 comments

At this moment, the library takes the last found IP from the 'lookup' config key. In documentation there is written "Having in mind when the key is found inside the attribute, that key will be used.", and I believe it should be the first taken.

I'd go with this changes to the lookup() method:

private function lookup($type, $keys)
    {
        $value = null;

        foreach ($keys as $key) {
            if (request()->$type->has($key)) {
                return request()->$type->get($key);
            }
        }

        return $value;
    }

boryn avatar Jan 18 '22 09:01 boryn

I've prepared a small PR for this: https://github.com/jamesmills/laravel-timezone/pull/79

boryn avatar Jan 18 '22 09:01 boryn