daily_collection_stats, weekly_route_performance, monthly_store_sales aggregation tables. Aggregator service is idempotent — wipes the slice and re-inserts. php artisan reports:aggregate (default: yesterday) for the nightly cron. Admin endpoints: daily-collection / trip-performance / store-sales chart series + totals, compliance.csv stream of dumpsite releases (DENR-style), POST rebuild for on-demand aggregation. Payments, notifications, and live tracking sub-modules of Module 13 are deferred per scope. 164 feature tests passing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
31 lines
693 B
PHP
31 lines
693 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class WeeklyRoutePerformance extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'weekly_route_performance';
|
|
|
|
protected $fillable = [
|
|
'week_start_date', 'route_id',
|
|
'on_time_rate_percent', 'avg_trip_duration_minutes',
|
|
'completion_rate_percent', 'trips_count',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return ['week_start_date' => 'date'];
|
|
}
|
|
|
|
public function route(): BelongsTo
|
|
{
|
|
return $this->belongsTo(\App\Models\Route::class);
|
|
}
|
|
}
|