Skip to content

Commit

Permalink
Merge pull request #614 from Laravel-Backpack/update-google-docs
Browse files Browse the repository at this point in the history
add note about key requirements
  • Loading branch information
pxpm authored Nov 22, 2024
2 parents 8ed8018 + a845b7e commit 6741015
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions 6.x/crud-fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -1138,6 +1138,13 @@ CRUD::field([ // Address google

Using Google Places API is dependent on using an API Key. Please [get an API key](https://console.cloud.google.com/apis/credentials) - you do have to configure billing, but you qualify for $200/mo free usage, which covers most use cases. Then copy-paste that key as your ```services.google_places.key``` value.

**IMPORTANT NOTE**: Your key needs access to the following APIS:
- Maps JavaScript API;
- Places API;
- Geocoding API.

While developing you can use an "unrestricted key" (no restrictions for where the key is used), but for production you should use a separate key, and **MAKE SURE** you restrict the usage of that key to your own domain.

So inside your ```config/services.php``` please add the items below:
```php
'google_places' => [
Expand Down Expand Up @@ -1558,6 +1565,13 @@ Using Google Places API is dependent on using an API Key. Please [get an API key
],
```

**IMPORTANT NOTE**: Your key needs access to the following APIS:
- Maps JavaScript API;
- Places API;
- Geocoding API.

While developing you can use an "unrestricted key" (no restrictions for where the key is used), but for production you should use a separate key, and **MAKE SURE** you restrict the usage of that key to your own domain.

**How to save in multiple inputs?**

There are cases where you rather save the information on separate inputs in the database. In that scenario you should use [Laravel mutators and accessors](https://laravel.com/docs/10.x/eloquent-mutators). Using the same field as previously shown (**field name is `location`**), and having `latitude`, `longitude`, `full_address` as the database columns, we can save and retrieve them separately too:
Expand Down
14 changes: 14 additions & 0 deletions 7.x-dev/crud-fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -1138,6 +1138,13 @@ CRUD::field([ // Address google

Using Google Places API is dependent on using an API Key. Please [get an API key](https://console.cloud.google.com/apis/credentials) - you do have to configure billing, but you qualify for $200/mo free usage, which covers most use cases. Then copy-paste that key as your ```services.google_places.key``` value.

**IMPORTANT NOTE**: Your key needs access to the following APIS:
- Maps JavaScript API;
- Places API;
- Geocoding API.

While developing you can use an "unrestricted key" (no restrictions for where the key is used), but for production you should use a separate key, and **MAKE SURE** you restrict the usage of that key to your own domain.

So inside your ```config/services.php``` please add the items below:
```php
'google_places' => [
Expand Down Expand Up @@ -1423,6 +1430,13 @@ Using Google Places API is dependent on using an API Key. Please [get an API key
],
```

**IMPORTANT NOTE**: Your key needs access to the following APIS:
- Maps JavaScript API;
- Places API;
- Geocoding API.

While developing you can use an "unrestricted key" (no restrictions for where the key is used), but for production you should use a separate key, and **MAKE SURE** you restrict the usage of that key to your own domain.

**How to save in multiple inputs?**

There are cases where you rather save the information on separate inputs in the database. In that scenario you should use [Laravel mutators and accessors](https://laravel.com/docs/10.x/eloquent-mutators). Using the same field as previously shown (**field name is `location`**), and having `latitude`, `longitude`, `full_address` as the database columns, we can save and retrieve them separately too:
Expand Down

0 comments on commit 6741015

Please sign in to comment.