i am trying to create a POSGIS Laravel Backpack CRUD and i generated the model and the controller. i have a model locations with the columns geom , name , address and i am trying to insert manually a value into the DB.
the functional postgis insert should be like this :
insert into locations (geom, name , address) values (st_geomfromtext('POINT(731948.274744 424549.929507)', 3844), 'test' , 'test navicat')
the manually value i am trying to apply to geom field is like this
$this->crud->addField([
'name' => 'geom',
'type' => 'hidden',
'value' => \DB::raw("st_geomfromtext('POINT(731948.274744 424549.929507)'), 3844)")
]);
but the sql error is
SQLSTATE[XX000]: Internal error: 7 ERROR: parse error - invalid geometry HINT: "st" <-- parse error at position 2 within geometry (SQL: insert into "locations" ("name", "address", "geom", "updated_at", "created_at") values (t, t, st_geomfromtext('POINT(731948.274744 424549.929507)'), 3844), 2021-01-21 10:29:15, 2021-01-21 10:29:15) returning "id")
i cannot figure it out how can i solve this problem thank you in advance
valueparameter for this. Could you also perhaps use a Laravel Mutator to do this inside the Model itself?laravel.com/docs/8.x/eloquent-mutators#defining-a-mutator - tabacitu