'date', 'active_user_count' => 'integer', 'login_count' => 'integer', 'api_request_count' => 'integer', 'api_error_count' => 'integer', 'api_avg_response_ms' => 'integer', ]; public function scopeForTenant($query, ?int $tenantId) { if ($tenantId) { return $query->where('tenant_id', $tenantId); } return $query; } public function scopeForDateRange($query, string $from, string $to) { return $query->whereBetween('stat_date', [$from, $to]); } public function scopeForDate($query, string $date) { return $query->where('stat_date', $date); } }