@php $totalAmount = $expenseByUser->sum('total_amount'); $totalEntries = $expenseByUser->sum('entry_count'); @endphp {{-- Stat cards --}}
Total Spend
{{ number_format($totalAmount, 2) }}
all users
Active Users
{{ $expenseByUser->count() }}
recorded expenses
Total Entries
{{ number_format($totalEntries) }}
across all users
Avg per User
{{ $expenseByUser->count() > 0 ? number_format($totalAmount / $expenseByUser->count(), 2) : '0.00' }}
average spend
Expenses by User {{ $expenseByUser->count() }} users
@if($expenseByUser->isEmpty())
No user expense data found.
@else @foreach($expenseByUser as $i => $row) @php $pct = $totalAmount > 0 ? round($row->total_amount / $totalAmount * 100, 1) : 0; @endphp @endforeach
# User Entries Avg per Entry Total Amount Share
{{ $i + 1 }} {{ $row->user_name }} {{ number_format($row->entry_count) }} {{ number_format($row->avg_amount, 2) }} {{ number_format($row->total_amount, 2) }}
{{ $pct }}%
Total {{ number_format($totalAmount, 2) }}
@endif