@extends('layouts.app') @section('title', 'Leaderboards') @section('content')

Leaderboards

See where you rank among the gaming elite

Time Period

Ranking Type

@if($period === 'daily') Today's Leaderboard {{ now()->format('F j, Y') }} @elseif($period === 'weekly') This Week's Leaderboard {{ now()->startOfWeek()->format('M j') }} - {{ now()->endOfWeek()->format('M j, Y') }} @elseif($period === 'monthly') This Month's Leaderboard {{ now()->format('F Y') }} @else All-Time Leaderboard Since the beginning @endif

@if($users->count() > 0)

Top Players @if($type === 'wins') by Wins @elseif($type === 'winnings') by Amount Won @else by Experience Points @endif

@foreach($users as $index => $user)
{{ $index + 1 }}
@if($user->avatar_url) {{ $user->username }} @else
{{ strtoupper(substr($user->username, 0, 1)) }}
@endif

{{ $user->username }}

Level {{ $user->level }} {{ number_format($user->xp) }} XP
@if($type === 'xp')
{{ number_format($user->xp) }}
Experience Points
@elseif($type === 'winnings')
₦{{ number_format($user->total_winnings ?? 0, 2) }}
Total Won
@else
{{ $user->total_wins ?? 0 }}
{{ $user->total_wins == 1 ? 'Win' : 'Wins' }}
@endif
@endforeach
@else
🏆

@if($period === 'daily') No Winners Today Yet @elseif($period === 'weekly') No Winners This Week Yet @elseif($period === 'monthly') No Winners This Month Yet @else No Rankings Yet @endif

@if($type === 'wins') Be the first to win a challenge @if($period !== 'all_time') {{ $period === 'daily' ? 'today' : ($period === 'weekly' ? 'this week' : 'this month') }}! @else and claim your spot! @endif @elseif($type === 'winnings') Be the first to earn winnings @if($period !== 'all_time') {{ $period === 'daily' ? 'today' : ($period === 'weekly' ? 'this week' : 'this month') }}! @else and claim your spot! @endif @else Start playing to appear on the leaderboard! @endif

@guest Join the Competition @else Browse Challenges @endguest
@endif
@auth

Your Current Standing

Your Rank
#{{ auth()->user()->getRank() ?? 'Unranked' }}
@if($type === 'xp')
Experience Points
{{ number_format(auth()->user()->xp) }}
Level
{{ auth()->user()->level }}
@elseif($type === 'wins') @php $userWins = auth()->user()->createdChallenges() ->where('result', 'creator_win') ->where('status', 'completed') ->count() + auth()->user()->acceptedChallenges() ->where('result', 'accepter_win') ->where('status', 'completed') ->count(); @endphp
Total Wins
{{ $userWins }}
Level
{{ auth()->user()->level }}
@else @php $userWinnings = auth()->user()->walletTransactions() ->where('type', 'prize') ->where('status', 'completed') ->sum('amount'); @endphp
Total Winnings
₦{{ number_format($userWinnings, 2) }}
Level
{{ auth()->user()->level }}
@endif
@endauth

Leaderboards update automatically as new games are completed. Refresh now

@endsection