Skip to content

Call to undefined method Grimzy\LaravelMysqlSpatial\Eloquent\SpatialExpression::getLat() #171

@pelmered

Description

@pelmered

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();
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions