laravel-mysql-spatial
laravel-mysql-spatial copied to clipboard
Call to undefined method Grimzy\LaravelMysqlSpatial\Eloquent\SpatialExpression::getLat()
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.
Same problem!
Do the following
$p = Point::fromWKT($elm->coordinates->getSpatialValue());
now you can use $p->getLng() $p->getLat()