initial round of changes from Claude
This commit is contained in:
44
app/Models/WeatherReport.php
Normal file
44
app/Models/WeatherReport.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class WeatherReport extends Model
|
||||
{
|
||||
/** @use HasFactory<\Database\Factories\WeatherReportFactory> */
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'type',
|
||||
'reported_at',
|
||||
'generated_at',
|
||||
'latitude',
|
||||
'longitude',
|
||||
'elevation_meters',
|
||||
];
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'reported_at' => 'datetime',
|
||||
'generated_at' => 'datetime',
|
||||
'latitude' => 'decimal:7',
|
||||
'longitude' => 'decimal:7',
|
||||
'elevation_meters' => 'decimal:4',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasMany<WeatherPeriod, $this>
|
||||
*/
|
||||
public function periods(): HasMany
|
||||
{
|
||||
return $this->hasMany(WeatherPeriod::class)->orderBy('period_number');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user