CenterMapAction, ZoomAction, etc.) extend Filament’s action system, enabling consistent UX across the admin panel.leaflet.markercluster, leaflet-fullscreen). Compatibility with existing Leaflet setups (e.g., custom plugins) is plausible but should be validated.DarkModeTile layer assumes Filament’s dark mode system is active. Custom themes may require adjustments.Dependency Setup:
composer require webbingbrasil/filament-maps
npm install leaflet leaflet.markercluster leaflet-fullscreen # if not already present
public/js or use a CDN.resources/views/vendor/filament/partials/scripts.blade.php loads Leaflet after Filament’s JS.Widget Implementation:
MapWidget in a Filament widget class (e.g., app/Filament/Widgets/MapWidget.php).getMarkers() (static or dynamic data).getActions() (e.g., ZoomAction, custom Filament actions).Dynamic Data:
public function getMarkers(): array {
return Location::query()
->get()
->map(fn ($location) => Marker::make($location->id)
->lat($location->lat)
->lng($location->lng)
->popup($location->name));
}
Customization:
// resources/js/filament-maps.js
document.addEventListener('filament-maps:init', (e) => {
e.detail.map.setView([51.505, -0.09], 13); // Custom init view
});
DarkModeTile layer, but custom CSS may be needed for map container styling.__() helper).webbingbrasil/filament-maps for Filament 3.x compatibility breaks. MIT license allows forks if needed.MarkerClusterGroup) or pagination.| Failure Point | Impact | Mitigation |
|---|---|---|
| Leaflet JS load failure | Blank map widget | Fallback to static image or error UI |
| Marker data API timeout | Empty markers | Cache responses, implement retries |
| Filament JS bundle conflict | Map actions non-functional | Isolate Leaflet in a separate script tag |
| Dark mode tile layer break | Visual regression in dark mode | Provide fallback light-mode tiles |
map.on('click', ...)) for custom interactions.getTitle(), getSubtitle()) for metadata.How can I help you explore Laravel packages today?