-
Notifications
You must be signed in to change notification settings - Fork 339
Closed
Description
I thought i'd put this here for anyone else that wanted it.
I wanted to orderByDistance and it was as simple as:
public function scopeOrderByDistance($query, $geometryColumn, $geometry)
{
$this->isColumnAllowed($geometryColumn);
$query->orderByRaw("st_distance(`$geometryColumn`, ST_GeomFromText(?))", [
$geometry->toWkt()
]);
return $query;
}Presumably you can add these scopes for the other columns as well.
pburel, muzafarali, adrianescalada, NicksonYap, lostfocus and 6 morelu40, adrianescalada, lostfocus, iSWORD, gl-pasci and 1 moreNicksonYap, iSWORD, gl-pasci and jonhassall
Metadata
Metadata
Assignees
Labels
No labels