class GooglePlaceField extends Select
{
protected string | Closure | null $country;
protected function setUp(): void
{
parent::setup();
$this->getSearchResultsUsing(static function (Select $component, ?string $search) {
$places = Places::autocomplete($search, ['types' => 'address']);
return collect($places)
->mapWithKeys(function ($place) {
return [$place->placeId() => $place->description()];
})->toArray();
});
}
}
class GooglePlaceField extends Select
{
protected string | Closure | null $country;
protected function setUp(): void
{
parent::setup();
$this->getSearchResultsUsing(static function (Select $component, ?string $search) {
$places = Places::autocomplete($search, ['types' => 'address']);
return collect($places)
->mapWithKeys(function ($place) {
return [$place->placeId() => $place->description()];
})->toArray();
});
}
}