1. Go to this page and download the library: Download fahiem/filament-pinpoint library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fahiem / filament-pinpoint example snippets
Pinpoint::make('location')->provider('leaflet')
use Fahiem\FilamentPinpoint\Pinpoint;
public static function form(Form $form): Form
{
return $form
->schema([
Pinpoint::make('location')
->label('Location')
->latField('lat')
->lngField('lng'),
TextInput::make('lat')
->label('Latitude')
->readOnly(),
TextInput::make('lng')
->label('Longitude')
->readOnly(),
]);
}
use Fahiem\FilamentPinpoint\Pinpoint;
Pinpoint::make('location')
->label('Business Location')
->defaultLocation(-6.200000, 106.816666) // Jakarta
->defaultZoom(15)
->height(400)
->draggable()
->searchable()
->latField('lat')
->lngField('lng')
->addressField('address') // Auto-fill address field
->shortAddressField('short_address') // Auto-fill short address field (exclude province, city, district, village, and postal code)
->provinceField('province') // Auto-fill province field
->cityField('city') // Auto-fill city/county field
->districtField('district') // Auto-fill district field
->villageField('village') // Auto-fill village/district field
->postalCodeField('postal_code') // Auto-fill postal/zip code field
->countryField('country') // Auto-fill country field
->streetField('street') // Auto-fill street field
->streetNumberField('street_number') // Auto-fill street number field
->columnSpanFull()
Pinpoint::make('location')
->radiusField('radius') // 'radius' is the column name in your database
->defaultRadius(500) // Default 500 meters