https://github.com/litstack/location
https://github.com/litstack/location
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/litstack/location
- Owner: litstack
- Created: 2021-01-20T08:11:38.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-07-14T13:56:43.000Z (almost 4 years ago)
- Last Synced: 2025-01-15T11:10:47.518Z (5 months ago)
- Language: Vue
- Size: 124 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Location
A field that stores the `lat`and `lng` values as well as further information of a place you can search like on google maps.
## Setup
Prepare your model with two float colums, e.g. `lat` and `lng` and set them fillable.
```php
$table->float('lat', 12, 9);
$table->float('lng', 12, 9);
```In order to use the location field you need an Google-API-Key with the following APIs activated:
- Maps JavaScript
- Places APIAdd this to your `lit` config.
```php
'location' => [
'google_api_key' => env('GOOGLE_API_KEY'),
],
```Now the map field can be used like this:
```php
$form->map('lat', 'lng');
```You can save further information from the Places-API like this:
```php
$form->map('lat', 'lng', [
'formatted_address' => 'address', // saves the formatted_address attribute in the address column of your model
]);
```