Download the PHP package mauricewijnia/nova-maps-address without Composer
On this page you can find all versions of the php package mauricewijnia/nova-maps-address. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mauricewijnia/nova-maps-address
More information about mauricewijnia/nova-maps-address
Files in mauricewijnia/nova-maps-address
Package nova-maps-address
Short Description A Laravel Nova Google Maps Field.
License MIT
Informations about the package nova-maps-address
Nova Maps Address
Nova Maps Address is a Nova field that allows the user to select an adress using the Google Places API and store it in a JSON column.
Table of Contents
- Installation
- Usage
Installation
To install the field simply run:
You will need a Google Maps API key with access to the Maps, Places and Geocoding API. You can place the key in your .env
file like this:
Usage
This fields stores its data as JSON in your column, so we will have to cast our column to an array.
To add the field to your resource you can do:
And in our model:
The resulting data will have this format:
Options
You can change some of the settings for the map by call the respective option method:
You can also pass parameters to Map js request and all options available for map/autocomplete/geocoder class. For example to specify a language and regions and filter the components:
Option | Description | Default |
---|---|---|
zoom | Set the default zoom level of the map | 10 |
center | Set the initial centering point of the map | |
types | Set the type of places that should be shown options are: establishment, address, geocode | |
allowMapClick | Allow user to click on the map to get the address | true |
autoCompleteOptions | Set options for AutoComplete class initialization. https://developers.google.com/maps/documentation/javascript/reference/places-widget#Autocomplete | N/A |
geocodeOptions | Set options for Geocoder class initialization. https://developers.google.com/maps/documentation/javascript/reference/geocoder#GeocoderRequest | N/A |
mapOptions | Set options for Map class initialization. https://developers.google.com/maps/documentation/javascript/reference/map#MapOptions | N/A |
scriptUrlParams | Set parameters during the request of Google Map API js. https://developers.google.com/maps/documentation/javascript/url-params | N/A |