@props(['versions', 'activity', 'latest']) @use('App\Models\UpdateVersion') @php /* | Derived from the collection the controller already loaded plus the one | grouped activity query the page makes — no extra round trips here. */ $total = $versions->count(); $published = $versions->where('status', UpdateVersion::STATUS_PUBLISHED)->count(); $security = $versions->where('security_update', true)->count(); // Downloads means downloads: the `downloaded` rows only, not every update // check an installation has ever made. Counting checks here would inflate // the figure by an order of magnitude. $downloads = (int) $activity->sum(fn ($counts) => (int) ($counts['downloaded'] ?? 0)); $installed = (int) $activity->sum(fn ($counts) => (int) ($counts['installed'] ?? 0)); $failed = (int) $activity->sum(fn ($counts) => (int) ($counts['failed'] ?? 0)); // Success is measured against installs that actually reported an outcome. // Counting silent installs as successes would turn "we have not heard back" // into "it worked". $reported = $installed + $failed; $success = $reported > 0 ? (int) round($installed / $reported * 100) : null; @endphp
merge(['class' => 'grid grid-cols-2 gap-3 sm:grid-cols-3 xl:grid-cols-6']) }}>