Query 1:
"SELECT * from search_table WHERE column>=4"
Eloquent ORM Implementation of 'Query1'
$searchResults = SearchTempTable::select(*);
$searchResults = $searchResults->where('column', '>=', 4);
Query 2:
"SELECT * FROM search_table WHERE ST_Intersects(column, geomfromtext( 'POLYGON(($point1X $point1Y, $point2X $point2Y, $point3X $point3Y,$point4X $point4Y,$point1X $point1Y))'))"
How can 'Query 2' be implemented in Eloquent ORM?
Only raw statement will work for this.
$bindings = [$point1X, $point1Y, ... ];
SearchTempTable::whereRaw(
"ST_Intersects(column, geomfromtext( 'POLYGON((? ?, ? ?, ? ?, ? ?, ? ?))' ))",
$bindings
)->get();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With