Laravel HTML Collective についてお聞きしたいです。だから私は場所のある形をしています。
この写真は、編集ページからのものです。緯度と経度はデータベースから取得されます。検索場所の後にその値を変更します。
そして、私はすでにGoogleマップAPI関数を作成して値を取得しています。しかし今、入力フォームを変更する方法を混乱させています。
だから、ここに私の関数コードがあります。
function codeAddress(address) {
geocoder.geocode({
'address': address
}, function(results, status) {
if (status == 'OK') {
var lng = results[0].geometry.location.lng();
var lat = results[0].geometry.location.lat();
console.log('lat:' + lat + ', lng:' + lng);
if (marker) { marker.setMap(null); }
marker = new google.maps.Marker({
position: {
lat: lat,
lng: lng
},
map: map,
icon : '{{ url('/images/marker.png') }}'
});
map.setCenter( new google.maps.LatLng(lat, lng) );
} else {
console.log('Geocode was not successful for the following reason: ' + status);
}
});
}
ここに私のページ edit.blade コードがあります
<div class="row">
<div class="col-lg-6">
{{ Form::label('longitude', 'Longitude') }}
{{ Form::number(
'longitude',
( isset($db) ) ? $db->longitude : null,
array(
'class' => 'form-control'
)
) }}
</div>
<div class="col-lg-6">
{{ Form::label('latitude', 'Latitude') }}
{{ Form::number(
'latitude',
( isset($db) ) ? $db->latitude : null,
array(
'class' => 'form-control'
)
) }}
</div>
</div>