Download the PHP package theabhishekin/filament-location without Composer
On this page you can find all versions of the php package theabhishekin/filament-location. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download theabhishekin/filament-location
More information about theabhishekin/filament-location
Files in theabhishekin/filament-location
Package filament-location
Short Description A Filament package for collecting and displaying user locations with Google Maps integration
License MIT
Informations about the package filament-location
Filament Location
A powerful Filament package for collecting and displaying user locations with Google Maps integration. This package provides easy-to-use location picker and display components for your Filament admin panels.
Features
- πΊοΈ LocationPicker: Interactive Google Maps component for forms
- π LocationColumn: Display locations in tables with clickable map modals
- π― Current Location: Get user's current location with GPS
- π§ Highly Customizable: Configurable zoom, map types, controls, and styling
- π± Responsive Design: Works perfectly on desktop and mobile
- π Multiple Location Types: Support for home, office, check-in/out locations
- π Distance Calculations: Built-in distance calculation utilities
- π¨ Custom Icons: Predefined and custom icon support
Installation
You can install the package via Composer:
Publish the configuration file:
Add your Google Maps API key to your .env file:
Note: Make sure to enable the Maps JavaScript API and Geocoding API in your Google Cloud Console.
Configuration
The configuration file allows you to customize default settings:
Database Migration
Add location fields to your model's migration:
Model Setup
Add the HasLocation trait to your model:
Quick Example: User Resource
Here's a complete example of how to use the location components in a Filament resource:
Usage
LocationPicker Component
LocationColumn Component
Available Icon Types
| Icon Type | Description | Default Color |
|---|---|---|
home |
Home locations | Blue |
office |
Office locations | Purple |
check-in |
Check-in locations | Green |
check-out |
Check-out locations | Orange |
travel |
Travel locations | Red |
Use Cases
- Employee Management: Track employee locations for check-in/check-out
- Customer Management: Store customer addresses and locations
- Venue Management: Manage multiple business locations
- Event Management: Record event locations and venue details
- Delivery Services: Track delivery addresses and routes
- Real Estate: Manage property locations
- Healthcare: Patient and facility location management
Distance Calculations
The HasLocation trait provides distance calculation utilities:
Security & HTTPS Requirements
β οΈ Important Security Notice:
The browser's Geolocation API requires a secure context to function properly. This means:
- β HTTPS connections (recommended for production)
- β localhost (for development)
- β HTTP connections will be blocked by modern browsers
Error Handling
The package provides comprehensive error handling with user-friendly messages:
| Error Type | Message | Description |
|---|---|---|
| HTTPS Required | π Location services require a secure connection (HTTPS) | Browser blocks geolocation on non-secure origins |
| Permission Denied | π« Location access denied. Please allow location permission | User explicitly denied location access |
| Position Unavailable | π Location information is unavailable | Device can't determine location |
| Timeout | β±οΈ Location request timed out | Location request exceeded timeout limit |
All errors are displayed in a prominent red banner below the location button with:
- π¨ Enhanced styling with gradient background
- π± Responsive design for mobile devices
- β¨ Smooth slide-in animation
- π Clear iconography and user-friendly messages
Development Setup
For local development, ensure you're using:
Troubleshooting
Common Issues
1. Livewire Entanglement Error
Error: Livewire property ['data.location'] cannot be found
Solution: Ensure your Livewire component has the property that matches your field name:
2. HTTPS/Security Errors
Error: Only secure origins are allowed
Solutions:
- Use HTTPS in production:
https://yourdomain.com - Use localhost for development:
http://localhost:8000 - Use Valet/Herd with SSL:
https://yourapp.test
3. Error Messages Not Showing
If error messages aren't displaying:
- Check console logs for JavaScript errors
- Verify Alpine.js is loaded before the LocationPicker
- Ensure CSS is published:
php artisan vendor:publish --tag=filament-location-assets
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Abhishek Sharma
- All Contributors
License
The MIT License (MIT). Please see License File for more information.