MoonShine MoonShine
EN
← All plugins

Leaflet field for MoonShine Laravel admin panel

MoonLeaflet - an interactive map field for MoonShine that allows selecting and saving location coordinates. Displays a map marker with a Google Maps link. Supports zoom customization, positioning, and saving to specified database fields.

Rating
Downloads
5
Version
1.0
Last updated
08.08.2025
MoonShine version
v3
Github stars
0
Estiven Muñoz
Author
Estiven Muñoz

Leaflet field for MoonShine Laravel admin panel

MoonLeaflet adds a map field to your forms, letting users pick their location using a Leaflet map. It's perfect for saving latitude and longitude easily. In table and detail views, it shows an icon that links to Google Maps with the saved coordinates for quick access.

example

Requirements

  • MoonShine v3.0+

Support MoonShine versions

MoonShine MoonLeaflet
3.0+ 1.0+

Installation

composer require estivenm0/moon-leaflet
composer require estivenm0/moon-leaflet

Usage

use Estivenm0\MoonLeaflet\Fields\Leaflet;
 
Leaflet::make('Location') // label
->initialPosition(latitude: 40.7580, longitude: -73.9855) //initial position
->columns('latitude', 'longitude') // columns in database
->isDraggable(true) // default is true
->minZoom(5) // min zom
->maxZoom(18) // max zoom
->zoom(14), // initial zoom
use Estivenm0\MoonLeaflet\Fields\Leaflet;
 
Leaflet::make('Location') // label
->initialPosition(latitude: 40.7580, longitude: -73.9855) //initial position
->columns('latitude', 'longitude') // columns in database
->isDraggable(true) // default is true
->minZoom(5) // min zom
->maxZoom(18) // max zoom
->zoom(14), // initial zoom

Note: The map will attempt to use the user's current location if location services are enabled. If no location is provided, the map will default to coordinates (0, 0).