FilamentF
Filament2y ago
kian

unable to call method

I am new to filament, and got assigned to a project to make a custom field for searching location through google maps api.

I am getting a little stick here. I'm using
$wire.newLocations($event.target.value)
to try and call a method in my component class (GeoMap), but keep getting this error Unable to call component method. Public method [newLocations] not found on component. When I post this method in my CreateLocation class it does work however. What is the reason for this, and how can I fix this?

// GeoMap.php
class GeoMap extends Field
{
    use HasExtraAlpineAttributes;

    protected string $view = 'forms.components.geo-map';

    protected float | Closure $lat = 0;

    protected float | Closure $lon = 0;


    public function getMapsUrl(): string
    {
        return MapsHelper::getMapUrl();
    }

    public function newLocations($address): array
    {
        return MapsHelper::getLocations($address);
    }
}
Was this page helpful?