I'm try to make a fake data through factory that contains a point
column.
The coordinate column in migration:
$table->point('coordinate');
I've tried in factory:
'coordinate' => DB::raw("Point(" . fake()->latitude() . " " . fake()->longitude() . ")"),
'coordinate' => "Point(" . fake()->latitude() . " " . fake()->longitude() . ")",
'coordinate' => fake()->latitude() . " " . fake()->longitude(),
'coordinate' => [fake()->latitude(), fake()->longitude()],
Is there any way to fake coordinate with point
column or using raw sql in factory?
I think you can try it with ST_GeomFromText
'coordinate' => DB::raw("ST_GeomFromText('POINT(" . $this->faker->latitude . " " . $this->faker->longitude . ")')"),