*/ class WeatherReportFactory extends Factory { /** * Define the model's default state. * * @return array */ public function definition(): array { return [ 'type' => fake()->randomElement(['hourly', 'weekly']), 'reported_at' => fake()->dateTimeBetween('-7 days', 'now'), 'generated_at' => fake()->dateTimeBetween('-7 days', 'now'), 'latitude' => fake()->latitude(39, 42), 'longitude' => fake()->longitude(-112, -110), 'elevation_meters' => fake()->randomFloat(4, 1000, 2000), ]; } public function hourly(): static { return $this->state(fn (array $attributes) => [ 'type' => 'hourly', ]); } public function weekly(): static { return $this->state(fn (array $attributes) => [ 'type' => 'weekly', ]); } }