Call to undefined method Grimzy\LaravelMysqlSpatial\Eloquent\SpatialExpression::getLat()
pelmered opened this issue · 0 comments
pelmered commented
There is an issue with the same error, but I don't think they are related. Here is that issue: #88
The solution proposed in that issue is also far from optimal and would require quite a lot of work to implement across the application, and it's really ugly.
I've been using this package a lot but suddenly I started to get this error.
The code is very simple:
$homeAddress = $this->homeAddress()->first();
$lat = $homeAddress->location->getLat();
$lng = $homeAddress->location->getLng();I have upgraded Laravel to 8.38.0 (was 8.33.1 before) and this package from 4.0 to 5.0 along with some major refactoring so it's a bit hard to track down exactly what caused this.
If I just add this to SpatialExpression, everything works fine:
public function getLat()
{
$this->value->getLat();
}
public function getLng()
{
$this->value->getLng();
}