I tried making fake data via a factory containing the point
column.
Coordinate columns in migration:
$table->point('coordinate');
I tried it at the 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 a way to fake the coordinates with the point
column or use raw sql in the factory?
P粉0424552502024-02-04 14:25:16
I think you can try using ST_GeomFromText
'coordinate' => DB::raw("ST_GeomFromText('POINT(" . $this->faker->latitude . " " . $this->faker->longitude . ")')"),