-
Notifications
You must be signed in to change notification settings - Fork 6
Working with Laravel 5
Ruslan A edited this page May 14, 2017
·
2 revisions
1. Open up config/app.php
and add the service provider to providers
array:
'providers' => [
Eseath\SxGeo\SxGeoServiceProvider::class,
]
2. Add the alias to aliases
array:
'aliases' => [
'SxGeo' => Eseath\SxGeo\Facades\SxGeo::class,
]
3. Add a config file to your an appliaction (optionally):
php artisan vendor:publish --provider "Eseath\SxGeo\SxGeoServiceProvider"
Get full information:
SxGeo::getCityFull($ip)
Get minimal information:
SxGeo::get($ip)
Update the database file:
php artisan sxgeo:update
For updating you need to specify link to database file through dbFileURL
parameter in the config:
- Countries — https://sypexgeo.net/files/SxGeoCountry.zip
- Cities — https://sypexgeo.net/files/SxGeoCity_utf8.zip
Default: https://sypexgeo.net/files/SxGeoCity_utf8.zip
<?php
namespace App\Http\Controllers;
use SxGeo;
use Illuminate\Http\Request;
class GeoController
{
public function index(Request $request)
{
$ip = Request::ip();
$geoData = SxGeo::get($ip);
return $geoData;
}
}