37 lines
1.2 KiB
PHP
37 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Attraction;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends Factory<Attraction>
|
|
*/
|
|
class AttractionFactory extends Factory
|
|
{
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
$categories = ['museum', 'restaurant', 'historic', 'park', 'cultural', 'entertainment', 'other'];
|
|
|
|
return [
|
|
'city_id' => \App\Models\City::factory(),
|
|
'name' => fake()->company() . ' ' . fake()->randomElement(['Museum', 'Restaurant', 'Park', 'Theater', 'Gallery']),
|
|
'description' => fake()->paragraph(),
|
|
'latitude' => fake()->latitude(),
|
|
'longitude' => fake()->longitude(),
|
|
'category' => fake()->randomElement($categories),
|
|
'source' => fake()->randomElement(['opentripmap', 'overpass', 'wikipedia']),
|
|
'source_id' => (string) fake()->randomNumber(8),
|
|
'rating' => fake()->optional(0.7)->randomFloat(2, 1, 5),
|
|
'image_url' => fake()->optional(0.5)->imageUrl(),
|
|
'cached_at' => now(),
|
|
];
|
|
}
|
|
}
|