Closed boonstoppel closed 1 year ago
Thanks for opening the issue. I will look into it
I just tried it with a similar call:
Port::whereHas('ships')
->stOrderBy(ST::distanceSphere(Point::makeGeodetic(50.0, 8.0), 'location'))
->dd();
This resulted in the correct query:
SELECT
*
FROM
"ports"
WHERE
EXISTS (
SELECT
*
FROM
"ships"
WHERE
"ports"."id" = "ships"."port_id")
ORDER BY
ST_DistanceSphere (public.ST_GeomFromEWKT ('SRID=4326;POINT(8 50)')::geometry,
"location"::geometry) ASC;
Could you please perform your query with an ->dd() instead of the ->get() and paste the result?
Closed due to no activity. If it's still a problem, we can reopen it anytime.
when adding stOrderBy to a query it ignores the previous conditions on the query:
In the case above the condition
whereHas
is totally ignored.