-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2272c2d
commit 375d97c
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
] | ||
|
||
``` | ||
|
||
|
||
|
||
|
||
|