43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\WeatherReport>
|
|
*/
|
|
class WeatherReportFactory extends Factory
|
|
{
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
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',
|
|
]);
|
|
}
|
|
}
|