feat: add Station, StationPrice, StationPriceCurrent, StationPriceArchive models and factories

This commit is contained in:
Ovidiu U
2026-04-03 18:46:53 +01:00
parent ec3a2bf848
commit 7f153fb08d
7 changed files with 258 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Models;
use App\Enums\FuelType;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
#[Fillable(['station_id', 'fuel_type', 'price_pence', 'price_effective_at', 'price_reported_at', 'recorded_at'])]
class StationPriceArchive extends Model
{
public $timestamps = false;
protected function casts(): array
{
return [
'fuel_type' => FuelType::class,
'price_effective_at' => 'datetime',
'price_reported_at' => 'datetime',
'recorded_at' => 'datetime',
];
}
public function station(): BelongsTo
{
return $this->belongsTo(Station::class, 'station_id', 'node_id');
}
}