gabrielesbaiz / nova-card-map
Custom Laravel Nova 4 map card.
Fund package maintenance!
Gabriele Sbaiz
Requires
- php: ^8.0
- illuminate/contracts: ^10.0||^11.0||^12.0
- laravel/nova: ^4.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^10.0.0||^9.0.0||^8.22.0
- pestphp/pest: ^3.0
- pestphp/pest-plugin-arch: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
README
Custom Laravel Nova 4 map card.
Original code from iMuMz/NovaCardMap
Features
- ✅ Support Leaflet
- ✅ Support Google Maps
- ✅ Marker clustering
- ✅ Map height
- ✅ Latitude and longitude coordinates
- ✅ GeoJSON
- ✅ Marker popup
- ✅ Custom marker icons
Installation
You can install the package via composer:
composer require gabrielesbaiz/nova-card-map
Usage
use Gabrielesbaiz\NovaCardMap; (new NovaCardMap())->width("1/2")
Available Methods
Height
(new NovaCardMap()) ->height('400px') // default is 300px
Google Maps
By default the provider is OpenStreetMaps.
You must set your Google Maps API key (https://developers.google.com/maps/documentation/javascript/get-api-key).
(new NovaCardMap()) ->googleApiKey('') ->googleMapType('roadmap'), // roadmap, satellite or hybrid
Latitude / Longitude (Point)
(new NovaCardMap()) ->type('LatLon') ->point('-6.081689','145.391881')
GeoJSON
(new NovaCardMap()) ->type('GeoJson') ->geoJson('')
GeoJson Example
{ "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": { "popup": "I am a Popup" }, "geometry": { "type": "Point", "coordinates": [ 23.8623046875, -30.221101852485987 ] } } ] }
Popup
(new NovaCardMap()) ->popup('popup')
Custom Marker Icon
(new NovaCardMap()) ->markerIcon('/images/marker-icon.png')
You can pass additional parameters to set the icon size and anchor
->markerIcon('/images/marker-icon.png',[100,100],[50,50])
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.