Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mariuscucuruz's avatar

Josrom\MapAddress\MapAddress save latitude / longitude

I've got a bit of a nag with the JoseVte/nova-map-address package for Nova. When I add MapAddress to a form which I then submit, it appears the latitude and longitude values are not picked up and saved on the Model. Probably not surprisingly it works fine alongside Text::make('Latitude')and Text::make('Longitude') but not on its own?

For reference, please here's my implementation:

   public function fields(Request $request)
    {
        return [
            ID::make()->hideFromIndex(),
            //Text::make('Latitude'),
            //Text::make('Longitude'),
            MapAddress::make('Map position')
                ->setLocation($this->latitude,$this->longitude)
                ->setLatitudeField('latitude')
                ->setLongitudeField('longitude'),
        ];
    }

Whith or without Text::make('Latitude') the payload is the same (only that the two fields are duplicated). Could maybe MapAddress be clearing the payload before it gets to the Model?

0 likes
1 reply
thaifani's avatar

you can do this MapAddress::make('Map position', 'address') ->initLocation('15.337921', '44.202267') ->zoom(16) ->setLocation($this->latitude, $this->longitude) ->setLatitudeField('latitude') ->setLongitudeField('longitude')

but the latitude,longitude will not be saved just address culomn

Please or to participate in this conversation.