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

Gaming Challenges

@auth @if(auth()->user()->canCreateChallenges()) Create Challenge @else Reach Level 2 to create challenges @endif @else Login to Create @endauth
@auth
🌍 Global Challenges 👥 Friends Only
@endauth
@auth @if(($filter ?? 'global') === 'friends')
👥 Showing challenges from your friends only

Switch to Global to see all challenges, or find more friends.

@endif @endauth
@forelse($challenges as $challenge)

{{ $challenge->game->name }}

by {{ $challenge->creator->username }}

@auth @if(auth()->user()->isFriendsWith($challenge->creator)) Friend @endif @endauth
₦{{ number_format($challenge->wager_amount) }}
per player
Format: Best of {{ $challenge->best_of }}
Platform: {{ ucfirst($challenge->game->platform) }}
Total Prize: ₦{{ number_format($challenge->wager_amount * 2) }}
Created: {{ $challenge->created_at->diffForHumans() }}
@if($challenge->rules_text)

Rules:

{{ Str::limit($challenge->rules_text, 100) }}

@endif
View Details @auth @if($challenge->canBeAcceptedBy(auth()->user()))
@csrf
@endif @endauth
@auth @if($challenge->creator_id !== auth()->id() && auth()->user()->hasPlayedWith($challenge->creator) && !auth()->user()->isFriendsWith($challenge->creator) && !auth()->user()->hasPendingRequestWith($challenge->creator))
@csrf
@endif @endauth
@empty
🎮
@auth @if(($filter ?? 'global') === 'friends')

No Friend Challenges

Your friends haven't created any challenges yet.

@else

No Open Challenges

Be the first to create a challenge!

@if(auth()->user()->canCreateChallenges()) Create First Challenge @endif @endif @else

No Open Challenges

Check back later or create your own challenge!

@endauth
@endforelse
@if($challenges->hasPages())
{{ $challenges->appends(request()->query())->links() }}
@endif
@endsection