查询 1:
"从search_table WHERE 列中选择 *>=4">
"查询1"的雄辩ORM实现
$searchResults = SearchTempTable::select(*);
$searchResults = $searchResults->where('column', '>=', 4);
查询 2:
"从search_table位置选择 * ST_Intersects(column, geomfromtext( 'POLYGON(($point 1X $point 1Y, $point 2X $point 2Y, $point 3X $point 3Y,$point 4X $point 4Y,$point 1X $point 1Y(('((">
如何在 Eloquent ORM 中实现"查询 2"?
只有raw
语句才能用于此。
$bindings = [$point1X, $point1Y, ... ];
SearchTempTable::whereRaw(
"ST_Intersects(column, geomfromtext( 'POLYGON((? ?, ? ?, ? ?, ? ?, ? ?))' ))",
$bindings
)->get();