initial round of changes from Claude
This commit is contained in:
58
database/factories/WeatherPeriodFactory.php
Normal file
58
database/factories/WeatherPeriodFactory.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\WeatherReport;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\WeatherPeriod>
|
||||
*/
|
||||
class WeatherPeriodFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
$isDaytime = fake()->boolean();
|
||||
$startTime = fake()->dateTimeBetween('-1 day', '+7 days');
|
||||
|
||||
return [
|
||||
'weather_report_id' => WeatherReport::factory(),
|
||||
'period_number' => fake()->numberBetween(1, 14),
|
||||
'name' => $isDaytime ? fake()->randomElement(['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']) : fake()->randomElement(['Monday Night', 'Tuesday Night', 'Overnight']),
|
||||
'start_time' => $startTime,
|
||||
'end_time' => (clone $startTime)->modify('+6 hours'),
|
||||
'is_daytime' => $isDaytime,
|
||||
'temperature' => fake()->numberBetween(20, 90),
|
||||
'temperature_unit' => 'F',
|
||||
'precipitation_probability' => fake()->numberBetween(0, 100),
|
||||
'dewpoint_celsius' => fake()->randomFloat(2, -10, 20),
|
||||
'relative_humidity' => fake()->numberBetween(20, 100),
|
||||
'wind_speed' => fake()->numberBetween(1, 20).' mph',
|
||||
'wind_direction' => fake()->randomElement(['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW', 'SSE', 'SSW', 'NNE', 'NNW']),
|
||||
'icon_url' => 'https://api.weather.gov/icons/land/day/sct?size=medium',
|
||||
'short_forecast' => fake()->randomElement(['Sunny', 'Partly Cloudy', 'Mostly Cloudy', 'Light Rain', 'Cloudy', 'Chance Rain']),
|
||||
'detailed_forecast' => fake()->optional()->sentence(15),
|
||||
];
|
||||
}
|
||||
|
||||
public function daytime(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'is_daytime' => true,
|
||||
'name' => fake()->randomElement(['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']),
|
||||
]);
|
||||
}
|
||||
|
||||
public function nighttime(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'is_daytime' => false,
|
||||
'name' => fake()->randomElement(['Monday Night', 'Tuesday Night', 'Overnight']),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user