@php // Switched off in Admin -> Pages: the band does not draw, on any layout that includes it. if (!section_on('stats')) { return; } /** * Platform stat counters. The REAL value is rendered as the static text so it * is meaningful without JS (and before the count-up runs); app.js animates from * 0 to the same target on scroll. Formatting (thousands separators, 1 decimal * for the rating) mirrors animateCount() in app.js so static and animated states * match exactly. * @var array $stats ['restaurants'=>int,'orders'=>int,'cuisines'=>int,'rating'=>float] */ // The second half of the same delivery band as sections/features above it — "Orders delivered" is // one of the four counters, and the two read as one block on every layout that carries them. if (!\App\Services\Capability::has(\App\Services\Capability::DELIVERY)) { return; } $stats = $stats ?? []; // An achievements board with nothing achieved: with no live restaurant, "0+" // counters read as a defect, not modesty — the whole band waits (the same rule // the rating counter below already follows). if ((int) ($stats['restaurants'] ?? 0) === 0) { return; } $items = [ [(float) ($stats['restaurants'] ?? 0), '+', t('home.stats.restaurants')], [(float) ($stats['orders'] ?? 0), '+', t('home.stats.orders')], [(float) ($stats['cuisines'] ?? 0), '+', t('home.stats.cuisines')], ]; // Only surface the average-rating counter once genuine reviews exist — never a // fabricated score on a fresh/unrated install. if ((float) ($stats['rating'] ?? 0) > 0) { $items[] = [(float) $stats['rating'], '', t('home.stats.rating')]; } /** Match app.js: 1 decimal only for non-integers, with thousands separators. */ $fmt = static function (float $n): string { $decimals = (fmod($n, 1.0) !== 0.0) ? 1 : 0; return number_format($n, $decimals); }; @endphp
@foreach ($items as [$num, $suffix, $label])
{!! $fmt($num) !!}@if ($suffix){{ $suffix }}@endif
{{ $label }}
@endforeach