Add Routing module: EvRoute, pricing, time slots, read API, caching (T3.1-T3.7)
Implements Phase 3 in full: EvRoute model with company/destination relations and a from/to-must-differ guard; the ev_route_time_slots pivot; RoutePricing with a per-route is_blocked flag (every route auto-manages exactly one price row per vehicle option via a fixed-row Filament repeater on both create and edit); PricingService::quote() with a shared VehicleOption enum; RoutingPlugin with the EvRouteResource admin UI (activation gated on non-blocked options being priced); the /api/v1/routes read API (list/show/pricing/time-slots, AI-agent-friendly nested shape); and Redis-tag-based response caching invalidated via EvRoute/RoutePricing observers.
This commit is contained in:
@@ -4,7 +4,9 @@ namespace Modules\Catalog\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Modules\Catalog\Database\Factories\DepartureTimeSlotFactory;
|
||||
use Modules\Routing\Models\EvRoute;
|
||||
|
||||
/**
|
||||
* A shared catalog of departure times, attached to routes via a pivot in the
|
||||
@@ -34,4 +36,11 @@ class DepartureTimeSlot extends Model
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
}
|
||||
|
||||
public function routes(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(EvRoute::class, 'ev_route_time_slots')
|
||||
->withPivot('is_active')
|
||||
->withTimestamps();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user