I try to use GeoIP on Laravel 5.5 and I have problem to get it work.
What I want
- I want get users ISO_CODE on visiting any page in my website. So I can use it in my chart as visitors country location.
Issues
- I can't get
iso_code
on my method (provided below) - How can I make it to get data in all my website and not provided static urls?
Codes
My method using Charts
//Header
use GeoIP as GeoIP;
class ChartController extends Controller
{
//.....
//Method
public function index()
{
//rest of my codes
$data = geoip()->getLocation();
$chart3 = Charts::create('geo', 'highcharts')
->title('My nice chart')
->elementLabel('My nice label')
->labels($data->pluck('iso_code'))
->dimensions(1000,500)
->responsive(true);
return view('admin.charts.index', compact('chart3'));
}
.....
}
Here is default code of charts package to use Geo chart
Charts::create('geo', 'highcharts')
->title('My nice chart')
->elementLabel('My nice label')
->labels(['ES', 'FR', 'RU'])
->colors(['#C5CAE9', '#283593'])
->values([5,10,20])
->dimensions(1000,500)
->responsive(false);
Error I get:
Call to undefined method Torann\GeoIP\Location::pluck()
Any idea how can I achieve what I need?
Thanks in advance