You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MoonLeaflet adds interactive map support to MoonShine. It allows users to select coordinates directly from a map or display multiple locations visually with Leaflet.
Map field with draggable marker
Multiple available map layers
Works in Form, Detail, and Index views
Component mode with multiple markers
Optional user geolocation support
Customizable zoom, drag, and layer
🧱 Example Previews
Field
Component
Support MoonShine versions
MoonShine
MoonLeaflet
3.x, 4.x
1.0
🧩 Installation
composer require itsmmunoz/moon-leaflet
🚀 Usage
Field
useItsmMunoz\MoonLeaflet\Fields\LeafletField;
LeafletField::make('Location') // label
->initialPosition(latitude: 40.7580, longitude: -73.9855) //initial position
->columns('latitude', 'longitude') // columns in database
->draggable(true) // draggable market (optional) default is true
Component
useItsmMunoz\MoonLeaflet\Components\LeafletMap;
LeafletMap::make('Business Locations') // label
->initialPosition(latitude: 40.7580, longitude: -73.9855) //initial position
->items(fn () => Business::all()
->map(function (Business$business) {
return [
'name' => $business->name,
'latitude' => $business->latitude,
'longitude' => $business->longitude,
];
})->toArray()) // Each item must include name, latitude, and longitude
💡 The map will attempt to use the user's location if geolocation is enabled.
If unavailable, it defaults to coordinates (0, 0).