Spatial Point functions using Laravel Eloquent ORM

2019-08-05 08:52发布

问题:

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 ..

回答1:

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