Forum

laravel: Cannot get...
 
Notifications
Clear all

laravel: Cannot get geometry object from data you send to the GEOMETRY field

1 Posty
1 Users
0 Reactions
1,820 Widok
0
Topic starter

full error: Numeric value out of range: 1416 Cannot get geometry object from data you send to the GEOMETRY field

using: https://github.com/grimzy/laravel-mysql-spatial

laravel 8

how to fix

1 Answer
0
Topic starter

dont' forget to modify your model

namespace App;

use Illuminate\Database\Eloquent\Model;
use Grimzy\LaravelMysqlSpatial\Eloquent\SpatialTrait;

/**
 * @property \Grimzy\LaravelMysqlSpatial\Types\Point   $location
 * @property \Grimzy\LaravelMysqlSpatial\Types\Polygon $area
 */
class Place extends Model
{
    use SpatialTrait;

    protected $fillable = [
        'name'
    ];

    protected $spatialFields = [
        'location',
        'area'
    ];
}

and remember that polygon array must have structure like

first_array_element == last_array_element

Odpowiedź

Author Name

Author Email

Your question *

 
Preview 0 Revisions Saved
Share: