An address field that autocomplete the user input to show suggested addresses using Google Place service.
You can install the package in to a Laravel app that uses Nova via composer:
composer require naif/address_autocomplete
Add the below to Nova/User.php resource:
AddressAutocomplete::make('Address'),
//You can add a country or countries to autocomplete or leave empty for all.
// Specify a single country
AddressAutocomplete::make('Address')
->countries('US'),
// Specify multiple countries [array]
AddressAutocomplete::make('Address')
->countries(['US','AU]),
Add the below to nova/resources/views/layout.blade.php
- To get resualts in specific language add (&language=en) to the below
<script src="https://maps.googleapis.com/maps/api/js?key={{env('ADDRESS_AUTOCOMPLETE_API_KEY')}}&libraries=places"></script>
Add the below to your .env file
Create an app and enable Places API and create credentials to get your API key https://console.developers.google.com
ADDRESS_AUTOCOMPLETE_API_KEY=############################
The MIT License (MIT). Please see License File for more information.