cheesegrits / filament-google-maps

Google Maps package for Filament PHP
234 stars 65 forks source link

Use autocomplete standalone? #57

Open francoism90 opened 11 months ago

francoism90 commented 11 months ago

I would like to use autocomplete, and save the results as a model later.

Is this possible? It seems to always expect model attributes.

Thanks

francoism90 commented 11 months ago
Select::make('organisation')
    ->required()
    ->relationship('organisation', 'name')
    ->createOptionForm([
        TextInput::make('full_address')
            ->hidden()
            ->reactive(),

        // Results in componentId cannot be found
        Map::make('location')
            ->autocomplete('full_address')
            ->autocompleteReverse(true)
            ->reverseGeocode([
                'street' => '%n %S',
                'city' => '%L',
                'state' => '%A1',
                'zip' => '%z',
            ])
    ])
    ->createOptionUsing(function (array $data) {
        // do custom stuff here
    })
    ->preload()
    ->searchable();