Closed danielwashbrook closed 3 years ago
@danielwashbrook Any PRs you send in would be greatly appreciated! :)
Cool, happy to put together a PR. Do you think the best approach would be a field option like ->fieldType('Point') vs ->fieldType('Text') or a trigger like ->isPointField() ?
@danielwashbrook I can't say without more context. Would it be a huge difference in code either way? Say, if you went one way, how hard would it be to flip to the other way?
It seems minimal effort either way. A condition in the fillAttributeFromRequest and resolve is all it really needs. But if we go with the fieldType() we could allow for 'Array' storage as well perhaps? We could go with both approaches and see 🤷
Wanted to follow up and see how this was coming and offer any support.
@danielwashbrook @nshontz Certainly still open for a PR, if you can submit one. :)
This is where I landed in my attempt: https://github.com/nshontz/nova-map-marker-field/commit/e3d375c0b0195dc557c81c4974edd15eaa41f022
BUT it seems like Laravel Nova is trying to serialize and log the change in action_events, because the shape data isn't UTF friendly it's throwing an error. I'm working on that now. If I can find a solution I'll write some documentation and submit the PR.
but if you have feedback on the code now, I'm happy to refactor as needed.
Implemented: MapMarker::make("Location") ->fieldType('point') ->pointField('location')
ActionEvent.php: 108 'original' => array_intersect_key($model->getRawOriginal(), $model->getDirty()),
Calling getRawOriginal here returns the raw shape data which yields something like "location":"�\u0010\u0000\u0000\u0001\u0001\u0000\u0000\u0000�Ye���T���q�xA@"
We've been using mysql's geo Point() field for storing the latitude and longitude values. I wrote a quick override to the fillAttributeFromRequest to handle this in our app. Is there any interest in merging this type of support into the main repo? Cheers