2021-02-22 11:17:40 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Database\Factories;
|
|
|
|
|
|
|
|
use App\Models\Location;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
|
2021-07-26 16:00:34 +02:00
|
|
|
/** @extends Factory<Location> */
|
2021-02-22 11:17:40 +01:00
|
|
|
class LocationFactory extends Factory
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Define the model's default state.
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
2023-05-24 22:21:54 +02:00
|
|
|
public function definition(): array
|
2021-02-22 11:17:40 +01:00
|
|
|
{
|
|
|
|
return [
|
|
|
|
'location' => $this->faker->randomElement([
|
|
|
|
$this->faker->sentence($this->faker->numberBetween(1, 10)),
|
2022-09-01 19:31:25 +02:00
|
|
|
str_replace("\n", ' ', $this->faker->address()),
|
2021-02-22 11:17:40 +01:00
|
|
|
]),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicate add lat,lng
|
|
|
|
*
|
|
|
|
* @return \Illuminate\Database\Eloquent\Factories\Factory
|
|
|
|
*/
|
|
|
|
public function withCoordinates()
|
|
|
|
{
|
|
|
|
return $this->state(function (array $attributes) {
|
|
|
|
return [
|
2022-09-01 19:31:25 +02:00
|
|
|
'lat' => $this->faker->latitude(),
|
|
|
|
'lng' => $this->faker->longitude(),
|
2021-02-22 11:17:40 +01:00
|
|
|
];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|