讨论数量:
github.com/grimzy/laravel-mysql-sp...
Mysql polygon 可以先了解一下
mysql 中有一些 ST_ 的功能可以用來 where
以下是其中一個例子
public function scopeClosestTo($query, $latitude, $longitude)
{
return $query->orderByRaw("
ST_Distance_Sphere(
point(longitude, latitude),
point(?, ?)
) asc
", [
$longitude,
$latitude,
]);
}
推荐文章: