Skip to content

Commit

Permalink
Add README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
mauricewijnia committed Sep 10, 2020
1 parent 2272c2d commit 375d97c
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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'
]

```





0 comments on commit 375d97c

Please sign in to comment.