Call to undefined method Grimzy\LaravelMysqlSpatial\Eloquent\SpatialExpression::getLat()
Satendra-SR opened this issue · 2 comments
Satendra-SR commented
Hi,
I'm trying to get latitude and longitude in my observer but can't able to do that.
In my Observer, If I dump the data

Result
If I retrive the data from database and then dump it, the results are different
Result
This approach is not considered as a good practice as we have the object already and then we are making a DB call for the same object.
Wanted to know, can we get the same object in first case. Do we have any support for observer here?
Any help will be highly appreciated. Thanks in advance.
faytekin commented
Same problem!
taufpate commented
Do the following
$p = Point::fromWKT($elm->coordinates->getSpatialValue());
now you can use
$p->getLng()
$p->getLat()


