空间点函数使用Laravel Eloquent ORM [英] Spatial Point functions using Laravel Eloquent ORM
本文介绍了空间点函数使用Laravel Eloquent ORM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我得到经度和纬度,并希望通过 mysql 存储位置
[空间点] p>
可以帮助我插入值的查询和函数是什么。
解决方案
您可以使用DB :: raw()来执行此操作:
DB :: table('table') - > insert([
'field'=> DB :: raw(SPECIAL_FUNC(X)),
]);
示例:
http://dev.mysql.com/doc/refman/4.1/en/point-property-functions.html
http://dev.mysql。 com / doc / refman / 5.0 / en / populating-spatial-columns.html
I get longitude and latitude and want to store the location with [Spatial Point] with mysql,,
what's the queries and functions that can help me to insert the values ..
解决方案
You can use DB::raw() to do this:
DB::table('table')->insert([
'field' => DB::raw("SPECIAL_FUNC(X)"),
]);
Examples: http://dev.mysql.com/doc/refman/4.1/en/point-property-functions.html http://dev.mysql.com/doc/refman/5.0/en/populating-spatial-columns.html
这篇关于空间点函数使用Laravel Eloquent ORM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文