@php $title = admin_trans('user_growth_chart'); $description = 'Track user registration growth over the last 12 months'; $icon = 'trending-up'; $stats = [ [ 'label' => 'Total Users', 'value' => number_format(array_sum(array_column($monthlyData, 'count'))), 'icon' => 'users', 'color' => 'primary' ], [ 'label' => 'This Month', 'value' => number_format(end($monthlyData)['count']), 'icon' => 'user-plus', 'color' => 'success' ], [ 'label' => 'Average/Month', 'value' => number_format(array_sum(array_column($monthlyData, 'count')) / count($monthlyData)), 'icon' => 'activity', 'color' => 'secondary' ], [ 'label' => 'Peak Month', 'value' => max(array_column($monthlyData, 'count')), 'icon' => 'zap', 'color' => 'warning' ], ]; @endphp @extends('admin.analytics.base') @section('analytics-content')

Monthly Breakdown

@foreach($monthlyData as $index => $item) {{ $item['month'] }} {{ number_format($item['count']) }} @if($index > 0) @php $previous = $monthlyData[$index - 1]['count']; $current = $item['count']; $change = $previous > 0 ? round((($current - $previous) / $previous) * 100, 1) : 0; @endphp
@if($change > 0) +{{ $change }}% @elseif($change < 0) {{ $change }}% @else 0% @endif
@else - @endif
@endforeach
@endsection @push('scripts') @endpush