theabhishekin/filament-location
Filament Location provides a ready-made location manager for Filament panels, letting you browse and manage countries, states, and cities through a clean admin interface. Ideal for apps that need reusable, structured geographic data without building custom resources.
composer require theabhishekin/filament-location (confirm the exact vendor/package name and Filament version constraint from the README — the repo is TheAbhishekIN/filament-location, and v1.0.0 targets Laravel 11–12 / PHP 8.1–8.3)..env so it stays out of version control.HasLocation trait to any model that stores coordinates, and make sure the underlying column exists (json column, or separate lat/lng columns — the package supports both).LocationPicker into a resource form and LocationColumn into the matching table. A "pick a store/venue/address on a map" field is the fastest way to validate the whole stack (key, assets, storage format) end to end.Where to look first: the package README for the exact LocationPicker / LocationColumn / trait method signatures, then the config file for map defaults (center, zoom, controls). Because this is a v1.0.0, treat the README as the source of truth rather than blog posts or older examples.
Pick one storage strategy per model and stick to it. JSON keeps the form field trivial (one column, one component) but makes SQL sorting/filtering and index use awkward. Separate lat/lng columns cost you a bit of form wiring but play far better with ORDER BY, bounding-box filters, and DB spatial indexes. Use decimal(10,8) for latitude and decimal(11,8) for longitude if you go the column route.
Form usage is the standard Filament shape — a schema component inside your resource form, e.g. LocationPicker::make('location'). Configure map controls per-field rather than globally when different resources need different zoom/center behavior (e.g. a warehouse picker vs. a customer address picker).
Table usage is a column component, typically LocationColumn::make('location') with an icon type selected from the 8 built-ins. The click-to-open-Google-Maps-modal behavior is the main day-to-day win: reviewers see the pin and can inspect it without leaving the list page. If your model uses separate lat/lng columns, expect to need a getStateUsing() closure or an accessor that returns the pair consistently, since the column needs one value to work with.
Distance work belongs behind the trait, not in controllers. The HasLocation trait gives coordinate helpers and Haversine distance — good for "distance from this record to that point" on a detail page, sorting a small in-memory collection, or a "nearest depot" lookup among a handful of candidates. For anything table-sized, wrap the Haversine in a query scope but pre-filter with a bounding box on lat/lng first so the DB can use an index, then let Haversine refine.
Testing and CI. Fully covered per the release, and CI runs PHP 8.1–8.3 / Laravel 11–12 — mirror that matrix in your own app if you're touching the package. In your app tests, set a dummy maps key in phpunit.xml so component rendering doesn't blow up, and prefer asserting on the underlying state/coordinates over asserting on rendered map markup.
Multi-panel apps: register the package's assets/plugin in each panel provider that uses it, not just the default admin panel, otherwise the map silently fails to load in secondary panels.
0,0 is a real point in the Gulf of Guinea and a very common artifact of an empty form being cast to floats. Null-check before any distance calc, and decide explicitly what "no location set" renders as in the column.HasLocation is a popular name; if the model already has location-ish methods or accessors (getLatitudeAttribute, a location() relation), you'll get silent overrides. Dump class_uses() and check method conflicts before blaming the package.^1.0 and review the changelog on minor bumps.How can I help you explore Laravel packages today?