0

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>
4

1 に答える 1