Torann / laravel-geoip

Determine the geographical location of website visitors based on their IP addresses.
http://lyften.com/projects/laravel-geoip
BSD 2-Clause "Simplified" License
2.11k stars 372 forks source link

Laravel 5.3 issue? #60

Closed mendrinos closed 8 years ago

mendrinos commented 8 years ago

Hello,

I am getting the following:

php artisan geoip:update The current service "Illuminate\Foundation\Application" does not support updating.

Also, whenever I use the geoip helper I am getting:

geoip('192.168.0.1');

[Symfony\Component\Debug\Exception\FatalThrowableError]
Call to undefined method Illuminate\Foundation\Application::hydrate()

Any idea?

Torann commented 8 years ago

Sounds like you need to update your config file. I bet the services are missing in yours.

I'm also adding a check so that the Application instance won't be sent as the service.

Look over the upgrade guide http://lyften.com/projects/laravel-geoip/doc/upgrade.html

sairam2188 commented 8 years ago

Same error for me.

I am getting the following: php artisan geoip:update [Exception] The GeoIP service is not valid.

Here is my config/geoip.php `<?php

return array(

/*
|--------------------------------------------------------------------------
| Service
|--------------------------------------------------------------------------
|
| Current only supports 'maxmind'.
|
*/

'service' => 'maxmind',

/*
|--------------------------------------------------------------------------
| Services settings
|--------------------------------------------------------------------------
|
| Service specific settings.
|
*/

'maxmind' => array(
    'type'          => env('GEOIP_DRIVER', 'database'), // database or web_service
    'user_id'       => env('GEOIP_USER_ID'),
    'license_key'   => env('GEOIP_LICENSE_KEY'),
    'database_path' => storage_path('app\geoip.mmdb'),
    'update_url'    => 'https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz',
),

/*
|--------------------------------------------------------------------------
| Default Location
|--------------------------------------------------------------------------
|
| Return when a location is not found.
|
*/

'default_location' => array (
    "ip"           => "127.0.0.0",
    "isoCode"      => "US",
    "country"      => "United States",
    "city"         => "New Haven",
    "state"        => "CT",
    "postal_code"  => "06510",
    "lat"          => 41.31,
    "lon"          => -72.92,
    "timezone"     => "America/New_York",
    "continent"    => "NA",
),

);`

My composer.json "torann/geoip": "^1.0", "geoip2/geoip2": "~2.1"

config/app providers \Torann\GeoIP\GeoIPServiceProvider::class, config/app aliases 'GeoIP' => \Torann\GeoIP\Facades\GeoIP::class,

Torann commented 8 years ago

You are using an old v0.2 config file. You need to upgrade it https://github.com/Torann/laravel-geoip/blob/master/config/geoip.php

sairam2188 commented 8 years ago

Thanks. Works fine.

Torann commented 8 years ago

Great to hear! 🎆

mendrinos commented 8 years ago

Thanks @Torann! all good from my side as well.