Noob Coder
Noob Coder

Reputation: 2896

laravel 5.1 dynamic google map based on users location

Would like to know how would I insert and google map in a user profile, that will show the user location based on the address in the mysql db. saw some tutorials but they are old and the new map variable is different, how to make it work?

Upvotes: 3

Views: 944

Answers (1)

astroanu
astroanu

Reputation: 3971

replace pos object with your position values; here's a working fiddle

var map = new google.maps.Map(document.getElementById('map'), {
    center: {lat: -34.397, lng: 150.644},
    zoom: 6
});

var infoWindow = new google.maps.InfoWindow({map: map});

var pos = {
    lat: 40,
    lng: 74
};

infoWindow.setPosition(pos);
infoWindow.setContent('Location found.');
map.setCenter(pos);

Upvotes: 1

Related Questions