emilianotisato / nova-google-autocomplete-field

Address Autocomplete with Google Place API (full metadata available)
20 stars 17 forks source link

Concatenate multiple geocoded results into a single value #15

Closed dniccum closed 3 years ago

dniccum commented 3 years ago

I added the ability to concatenate certain elements of the geocoded object that is returned by Google, using {{ and }}, wrap the key like you would above; like so:

use EmilianoTisato\GoogleAutocomplete\AddressMetadata;
use EmilianoTisato\GoogleAutocomplete\GoogleAutocomplete;

GoogleAutocomplete::make('Address')->withValues(['latitude', 'longitude']),

AddressMetadata::make('coordinates')->fromValue('{{latitude}}, {{longitude}}'),

So the value that would be rendered within the coordinates filed would be something like:

39.3315476, -94.9363912
emilianotisato commented 3 years ago

@dniccum Thanks!! I'll check this on this weekend and let you know when merged...

dniccum commented 3 years ago

@emilianotisato If you get a second, could you label my PR's as hacktoberfest-accepted so I can get credit for them? Thanks man.

https://hacktoberfest.digitalocean.com/hacktoberfest-update