cheesegrits / filament-google-maps

Google Maps package for Filament PHP
212 stars 60 forks source link

Cannot fill address fields using reverseGeocode function #99

Open abishekrsrikaanth opened 2 months ago

abishekrsrikaanth commented 2 months ago

I have the address_1 and address_2 fields on my form and I want to fill the address_2 field, but I can't seem to find the correct field name for the rest of the address here https://github.com/cheesegrits/filament-google-maps?tab=readme-ov-file#reverse-geocoding. How do I go about doing this? Anyway to get these fields here https://developers.google.com/maps/documentation/javascript/supported_types#table2

Here is the code I have

Geocomplete::make('address_1')
      ->reverseGeocode([
          'address_1' => '%n %S',
          'address_2' => '%a1 %a2 %a3 %a4 %L %p',
          'zip' => '%z',
      ])
      ->countries(fn () => [Filament::getTenant()->location->country->iso_3166_2])
      ->lazy(),

CleanShot 2024-04-26 at 16 54 40

Also, is there a way to set the latitude and longitude fields on the afterStateUpdated method?