stevebauman / location

Detect a users location by their IP Address.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Call to undefined method GeoIp2\Record\Location::get()

sonsoixam opened this issue · comments

namespace App\Http\Controllers;

use GeoIp2\Record\Location;

use Illuminate\Http\Request;

use App\Traits\ValidateTrait;

class TestController extends Controller

{

use ValidateTrait;



public function index(Request $request)

{

    $ip = request()->ip();

    $position = Location::get($ip);

    return $position;

}

}

Hi @sonsoixam,

You must import the Location facade:

use Stevebauman\Location\Facades\Location;

Location::get();