57 lines
1.3 KiB
PHP
57 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class WeatherPeriod extends Model
|
|
{
|
|
/** @use HasFactory<\Database\Factories\WeatherPeriodFactory> */
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'weather_report_id',
|
|
'period_number',
|
|
'name',
|
|
'start_time',
|
|
'end_time',
|
|
'is_daytime',
|
|
'temperature',
|
|
'temperature_unit',
|
|
'precipitation_probability',
|
|
'dewpoint_celsius',
|
|
'relative_humidity',
|
|
'wind_speed',
|
|
'wind_direction',
|
|
'icon_url',
|
|
'short_forecast',
|
|
'detailed_forecast',
|
|
];
|
|
|
|
/**
|
|
* @return array<string, string>
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'start_time' => 'datetime',
|
|
'end_time' => 'datetime',
|
|
'is_daytime' => 'boolean',
|
|
'temperature' => 'integer',
|
|
'precipitation_probability' => 'integer',
|
|
'dewpoint_celsius' => 'decimal:2',
|
|
'relative_humidity' => 'integer',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return BelongsTo<WeatherReport, $this>
|
|
*/
|
|
public function report(): BelongsTo
|
|
{
|
|
return $this->belongsTo(WeatherReport::class, 'weather_report_id');
|
|
}
|
|
}
|