stevebauman / location

Detect a users location by their IP Address.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IP defaulting to 66.102.0.0

marlongichie opened this issue · comments

I am using Location::get(); to detect the user's location, but it always returns results based on the localhost_testing_ip. I have even tried setting this value to null, but still the same result.

Here is a snippet from my config file:

/*
     * If your running your website locally and want to test different
     * IP addresses to see location detection set to true
     */
    'localhost_testing' => false,
    /*
     * Removes the location key from the session so it is retrieved on every
     * request for testing purposes
     */
    'localhost_forget_location' => false,
    /*
     *  IP to check for localhost testing *default is Google Host in US*
     */
    'localhost_testing_ip' => '66.102.0.0',
    /*
     * Default Dropdown Configuration:
     * Value is the value of the selected item in the dropdown
     * Name is the appearance of the selected item
     */

Anyone else experiencing this? Any suggestions?

Hi, have you tried clearing Laravel's cache using php artisan cache:clear?

Hello, thanks for your speedy response.

I managed to figure out what the problem was. I am using Laravel Forge for deployment, which allows setting environment variables directly from the interface.

My config file was setting the value like so: 'localhost_testing' => getenv('LOCAL_TESTING'),

My env file on on the local environment uses: LOCAL_TESTING => true , which works as expected.

However, when this variable is set from the Laravel Forge interface it is set as LOCAL_TESTING => 'false' , which is a string variable and not boolean and evaluate as true.

Manually updating the environment value in production environment to: LOCAL_TESTING => false, resolved the issue for me.

Your assistance is much appreciated, and thanks again for the quick response.

Great to hear you've fixed the issue! And no problem at all.

If you encounter anymore issues, please feel free to submit another.

-- Steve