Files
Verde-Web/app/Models/DailyCollectionStat.php
admin 0a2e187f45 feat(backend): complete Module 13 reports + analytics
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>
2026-04-30 02:58:09 +08:00

34 lines
779 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class DailyCollectionStat extends Model
{
use HasFactory;
protected $fillable = [
'date', 'barangay_id', 'total_scans', 'total_weight_kg',
'unique_households', 'missed_pickups',
];
protected function casts(): array
{
return [
'date' => 'date',
'total_scans' => 'integer',
'total_weight_kg' => 'integer',
'unique_households' => 'integer',
'missed_pickups' => 'integer',
];
}
public function barangay(): BelongsTo
{
return $this->belongsTo(Barangay::class);
}
}