Skip to content

Commit

Permalink
Ability to set a custom title (#20)
Browse files Browse the repository at this point in the history
* Ability to set a custom title

* Minor fix + Change default title

* Revert the original default title
  • Loading branch information
mohamedsabil83 authored Dec 31, 2021
1 parent ad5b056 commit bcd8201
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ composer require larswiegers/laravel-maps
## Supported map types
| What | Basic map | Centerpoint | Basic markers | Zoomlevel | Can use different tiles |
| ------------- |:-------------:|:------------:|:--------------:|:----------:|:------------------------:|
| Leaflet ||||||
| Google maps ||||||
| Leaflet ||||||
| Google maps ||||||

#### Tilehosts
##### Openstreetmap
Openstreetmap is a creative commence tile library created by volunteers.
Openstreetmap is a creative commence tile library created by volunteers.
No configuration has to be set to use as it is the default tilehost for this library.
More information can be found here: [openstreetmap.org](https://www.openstreetmap.org)

##### Mapbox
Mapbox is a for profit company that also offers free keys.
Their map can be more accurate / precise.
Mapbox is a for profit company that also offers free keys.
Their map can be more accurate / precise.
To get your free key go to [mapbox.com](https://account.mapbox.com/auth/signup/)
Once logged in you can get your free key and use it by placing it in the env file like this ``MAPS_MAPBOX_ACCESS_TOKEN``.
Once logged in you can get your free key and use it by placing it in the env file like this ``MAPS_MAPBOX_ACCESS_TOKEN``.
## Usage
### Leaflet

Expand Down Expand Up @@ -63,11 +63,14 @@ Once logged in you can get your free key and use it by placing it in the env fil
// Set markers on the map:
<x-maps-google :markers="[['lat' => 52.16444513293423, 'long' => 5.985622388024091]]"></x-maps-google>
// You can customize the title for each markers:
<x-maps-google :markers="[['lat' => 52.16444513293423, 'long' => 5.985622388024091, 'title' => 'Your Title']]"></x-maps-google>
```
#### Google maps api key
You can get an api key here:
![console.cloud.google.com](https://console.cloud.google.com/project/_/apiui/credential)
Create an api key and enable the Maps Javascript API in the console aswell.
Create an api key and enable the Maps Javascript API in the console aswell.
Place the api key in the env file like this ``MAPS_GOOGLE_MAPS_ACCESS_TOKEN``
### Testing
To run the tests just use the following component:
Expand Down Expand Up @@ -95,4 +98,3 @@ If you discover any security related issues, please email [email protected] in
## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

2 changes: 1 addition & 1 deletion resources/views/components/google.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function initMap{{$mapId}}() {
lng: {{$marker['long'] ?? $marker[1]}}
},
map: map{{$mapId}},
title: "Hello World!",
title: "{{ $marker['title'] ?? 'Hello World!' }}",
});
@endforeach
}
Expand Down

0 comments on commit bcd8201

Please sign in to comment.