From 375d97c9393c4e6ae165ef1fc303e981d66f6670 Mon Sep 17 00:00:00 2001 From: Maurice Wijnia Date: Thu, 10 Sep 2020 17:58:14 +0200 Subject: [PATCH] Add README.md --- README.md | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..0a738a0 --- /dev/null +++ b/README.md @@ -0,0 +1,50 @@ +# 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 + +1. [Installation](#installation) +2. [Usage](#usage) + +## Installation + +To install the field simply run: +``` +composer require mauricewijnia/nova-maps-address +``` + +You will need a Google Maps API key with access to the Places API. You can place the key in your `.env` file like this: +``` +NOVA_MAPS_ADDRESS_KEY="you_key_here" +``` + +## Usage +This fields stores it's 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: + +```php +use Mauricewijnia\NovaMapsAddress\MapsAddress; +... +public function fields(Request $request) { + return [ + ... + MapsAddress::make(__('Address'), 'address'), + ... + ]; +} +``` + +And in our model: +```php + +protected $casts = [ + 'location' => 'array' +] + +``` + + + + +