jeudi 30 août 2018

How can I save additional data in my Laravel Nova fields?

I am using Laravel Nova and really enjoying it so far.

I have a Place field that I am successfully collecting the address, city, state etc.

I would also like to save the geolocation data that is returned by the Algolia API.

Specifically, I want to store:

"_geoloc":{"lat":xx.xxx,"lng":-xx.xxx}

Is this where an observer comes into play? I have tried that but I am only getting the data from the model. Not the data returned by Algolia.

I would like to say "Hey, save address, city & state like normal, but also save _geoloc into my lat and lng fields."

Is there a way to do that?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire