I'm trying to add a cordinate input for a laravel voyager bread.

But I'm getting this issue when creating item.

SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\x8C5\xB7\x9D\x11\xFD...' for column 'location' at row 1 (SQL: insert into places (name, location, status, updated_at, created_at) values (Reg 2, ST_GeomFromText('POINT(79.9542002 7.0046719)'), INACTIVE, 2020-12-03 14:02:05, 2020-12-03 14:02:05))

I have this inside Place model

namespace App;

use Illuminate\Database\Eloquent\Model;
use TCG\Voyager\Traits\Spatial;

class Place extends Model
{
    use Spatial;
    protected $spatial = ['location'];
}

And location field is a varchar column with 255 length. Google map is available and I can select a place but when I submit the form I get this error.

1

There are 1 answers

0
vimuth On BEST ANSWER

Seems like needed to add datatype in the table as geometry. Adding it in case anyone met with the same issue.