Now I was using a JavaScript code for the map in the control panel. All that is supposed to be in it is to keep a pin marker and it can be used by cyclists and paths, and it combines the lat, the lng and the radius, and they are modified in the query. The problem now is that the marker itself is not initially visible. He doesn't open the door. Is it possible for someone to have an explanation for this topic, even though this code was working before that?
Controller Code:
public function edit($id)
{
$user=User::find($id);
$ns=User::where('id',$id)->get();
return view('pages.users.edit',compact('user','ns'));
}
Script Code:
<script>
var ns = {!! json_encode($ns->toArray()) !!};
function initMap() {
var canvas = document.getElementById('map');
for (var i = 0,feature; feature = ns[i]; i++) {
var myLatlng = new google.maps.LatLng(feature.lat, feature.lng);
}
var mapOptions = {
zoom: 8,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(canvas, mapOptions);
for (var i = 0,feature; feature = ns[i]; i++) {
console.log();
var circleOptions = {
draggable: true,
editable: true,
strokeColor: '#eeeeee',
strokeOpacity: 0.8,
strokeWeight: 1,
fillColor: '#FF0000',
fillOpacity: 0.15,
map: map,
center: myLatlng,
radius:feature.radius,
};
}
var circle = new google.maps.Circle(circleOptions);
google.maps.event.addListener(circle, 'center_changed', update);
google.maps.event.addListener(circle, 'radius_changed', update);
function update() {
var d = Math.pow(10,5);
let lat = Math.round(circle.getCenter().lat()*d)/d
let lng = Math.round(circle.getCenter().lng()*d)/d
let radius = Math.round(circle.getRadius())
$('#lat').val(lat)
$('#lng').val(lng)
$('#radius').val(radius)
}
update();
}
</script>