erkurn / filament-address-picker
Pick Or Auto Complete Address For Filament Field
v1.1.3
2022-10-04 01:21 UTC
Requires
- php: ^8.1
- geocoder-php/cache-provider: ^4.4
- geocoder-php/chain-provider: ^4.0
- geocoder-php/geo-plugin-provider: ^4.0
- geocoder-php/google-maps-provider: ^4.0
- guzzlehttp/psr7: *
- http-interop/http-factory-guzzle: ^1.0
- illuminate/cache: ^5.0|^6.0|^7.0|^8.0|^9.0
- illuminate/contracts: ^9.0
- illuminate/support: ^5.0|^6.0|^7.0|^8.0|^9.0
- php-http/curl-client: *
- spatie/laravel-package-tools: ^1.9.2
- willdurand/geocoder: ^4.0
Requires (Dev)
- filament/filament: ^2.0
- laravel/pint: ^1.0
- nunomaduro/collision: ^6.0
- orchestra/testbench: ^7.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpunit/phpunit: ^9.5
README
Pick Address For Filament Field
A Filament Field to enable pick location in google map and return geo coordinates. For initial location you can use coordinate or address.
this packages require Google Map API and using this service :
- Maps JavaScript API
- Places API
Installation
You can install the package via composer:
composer require erkurn/filament-address-picker
Usage
<?php class FilamentResource extends Resource { public static function form(Form $form) { return $form->schema([ AddressPicker::make('coordinate') ->setDefaultLocation([ // Set Default Location 'lat' => -6.914744, 'lng' => 107.609810 ]) ->mapControls([ // Map Controls 'mapTypeControl' => true, 'scaleControl' => true, 'streetViewControl' => false, 'rotateControl' => true, 'fullscreenControl' => true, 'searchBoxControl' => true ]) ->minHeight(300) // Min Height In Pixels ->defaultZoom(16) // Default Zoom ->placeholder("Search Address") // Default Search ->afterStateUpdated(function ($state, $component, $set) { $location = $component->getAddress(); // Get Details Location After Pick Location $location->getAdminLevels()->get(4)->getName(); // Post Code $location->getStreetName(); // Street Name $location->getStreetNumber(); // Street Number }) ->placeholder("Search Address") ]); } }
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.