devmtm / nova-address-autocomplete

Nova address field that autocomplete the user input to show suggested addresses using Google Place service.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nova Address AutoComplete Field

An address field that autocomplete the user input to show suggested addresses using Google Place service.

Installation

You can install the package in to a Laravel app that uses Nova via composer:

composer require naif/address_autocomplete

Usage:

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=############################

Package screenshot

License

The MIT License (MIT). Please see License File for more information.

About

Nova address field that autocomplete the user input to show suggested addresses using Google Place service.


Languages

Language:Vue 56.9%Language:PHP 29.0%Language:JavaScript 13.7%Language:CSS 0.5%