- What is filament-map-picker and what does it do?
- It is a Filament form field that adds an interactive map to your Laravel admin panel. Users click or drag a marker on the map to choose a location, and the resulting latitude and longitude are stored on your model. It is aimed at developers who need a location picker inside Filament forms without building map integration themselves.
- How do I install filament-map-picker in a Laravel app?
- Install it with Composer using composer require tareq-alqadi/filament-map-picker. Because it is a Filament field, no separate service provider registration is normally needed beyond Laravel's package discovery. After installing, add the field to a Filament form schema and point it at your latitude and longitude columns.
- Which Filament versions does this map picker support?
- The package is packaged as a Filament form field, so its Filament constraint is defined in its composer.json. Check that constraint and the README before installing to confirm it matches the Filament major version in your project. If you are upgrading Filament, verify the field still resolves before rolling it out to production panels.
- How do I save latitude and longitude to my model with this field?
- Add the map picker field to your Filament form schema and bind it to the two coordinate columns on your model, typically latitude and longitude. When the form is submitted, the selected marker position is written through Filament's normal state handling, so nothing custom is needed on the model side. Make sure both columns exist in the database and are fillable or otherwise mass-assignable.
- Can users drag the marker instead of clicking the map?
- Yes. The field supports both interactions: clicking anywhere on the map moves the marker, and dragging the existing marker repositions it. Either way the coordinates update in the form state, so the saved value always reflects the final marker position.
- Do I need a Google Maps API key to use this map picker?
- Map fields depend on a tile source, and whether that source requires a key depends on the provider configured for the field. Review the README for the exact configuration options and any credentials the default setup expects. If your provider requires a key, store it in your .env file rather than committing it to the repository.
- How do I make the map picker field required or validate the coordinates?
- Treat it like any other Filament field: chain required() to force a selection before the form can be saved. You can also add numeric or range rules to catch coordinates that fall outside valid latitude and longitude bounds. Validating on the server side is worth doing even though the marker constrains input, since request payloads can be manipulated.
- Can I use filament-map-picker outside Filament, in a plain Blade form?
- The package is built specifically as a Filament form field, so its intended use is inside Filament resources, pages, and custom forms. If you need a picker in a plain Blade or Livewire form, you would generally use a standalone JavaScript map library instead. Mixing the field into non-Filament views is not the documented path and may need extra wiring.
- How do I test a form that uses the map picker?
- Filament fields are typically exercised through Livewire tests using Filament's form testing helpers, asserting the field state and the resulting model attributes after submission. Set the coordinate state programmatically in the test rather than simulating map interactions, which are browser-level behaviour. If your test environment loads external tiles, stub or disable those requests so the suite stays fast and offline-friendly.
- What are the alternatives to filament-map-picker, and is it actively maintained?
- Alternatives include other Filament map field packages and building a custom field around a JavaScript map library such as Leaflet. Before committing, check the repository's recent commits, open issues, and Filament version constraints to judge maintenance activity. For long-lived projects, confirming that the package tracks current Filament releases is more important than a feature comparison.