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>
This commit is contained in:
33
app/Models/DailyCollectionStat.php
Normal file
33
app/Models/DailyCollectionStat.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user