An interactive OpenStreetMap/Leaflet picker. Stores coordinates and an optional address.
Field::map(string $key): MapField->defaultLat(float $lat): static
->defaultLng(float $lng): static
->zoom(int $zoom): static // Default: 13
->height(int $px): static // Admin map height. Default: 400{
"office_location": {
"lat": 48.8566,
"lng": 2.3522,
"zoom": 14,
"address": "Paris, France"
}
}Field::map('office_location')
->label('Office Location')
->defaultLat(48.8566)
->defaultLng(2.3522)
->zoom(12),@php $loc = ctrlfield_get('office_location') @endphp
@if($loc)
<div id="map"
data-lat="{{ $loc['lat'] }}"
data-lng="{{ $loc['lng'] }}"
data-zoom="{{ $loc['zoom'] }}">
</div>
<p>{{ $loc['address'] }}</p>
@endifInitialize the map with your preferred JS library using the data attributes.