@extends('layouts.app')
@section('title', 'Jogadores - GIGAX ARENA')
@section('page_title', 'Jogadores')
@section('content')
@php
$playersCollection = collect($players ?? []);
$currentSearch = trim((string) ($search ?? request('search', '')));
$currentSort = (string) ($sort ?? request('sort', 'latest'));
$currentPage = max(1, (int) ($page ?? request('page', 1)));
$pages = max(1, (int) ($totalPages ?? 1));
$listed = (int) ($total ?? $playersCollection->count());
$getId = fn($p) => $p->user_id ?? $p->id ?? null;
$getName = fn($p) => $p->nickname ?? $p->name ?? 'Jogador';
$getAvatar = fn($p) => $p->avatar_url ?? $p->avatar ?? $p->photo ?? null;
$initial = function ($name) {
$name = trim((string)$name);
if ($name === '') return 'G';
return function_exists('mb_substr')
? mb_strtoupper(mb_substr($name, 0, 1))
: strtoupper(substr($name, 0, 1));
};
$hasRealAvatar = function ($avatar) {
$avatar = trim((string)$avatar);
return $avatar !== '' && stripos($avatar, 'default-avatar') === false;
};
$onlineCount = $playersCollection->filter(function ($p) {
return (bool)($p->is_online ?? $p->online ?? false);
})->count();
$playedCount = $playersCollection->filter(function ($p) {
return (int)($p->matches_played ?? 0) > 0;
})->count();
@endphp
{{-- HERO / RESUMO --}}
GIGAX ARENA
Comunidade de Jogadores
Encontre jogadores, consulte perfis e conecte-se com a comunidade sem poluição visual.
Jogadores
{{ number_format($listed,0,',','.') }}
Online nesta página
{{ $onlineCount }}
Com partidas
{{ $playedCount }}
{{-- BUSCA --}}
{{-- CONTEÚDO --}}
Jogadores encontrados
{{ number_format($listed,0,',','.') }} registros
Página {{ $currentPage }} de {{ $pages }}
@forelse($playersCollection as $player)
@php
$playerId = $getId($player);
$nickname = $getName($player);
$avatar = $getAvatar($player);
$level = max(1, (int)($player->skill_level ?? $player->level ?? 1));
$matches = max(0, (int)($player->matches_played ?? 0));
$hasPlayed = $matches > 0;
$points = $hasPlayed ? max(0, (int)($player->total_points ?? 0)) : 0;
$kd = $hasPlayed ? max(0, (float)($player->kd_ratio ?? 0)) : 0;
$wins = $hasPlayed ? max(0, (int)($player->wins ?? 0)) : 0;
$losses = $hasPlayed ? max(0, (int)($player->losses ?? 0)) : 0;
$isOnline = (bool)($player->is_online ?? $player->online ?? false);
$statusText = $isOnline ? 'Online' : 'Offline';
@endphp
@if($hasRealAvatar($avatar))
{{ $initial($nickname) }}
@else
{{ $initial($nickname) }}
@endif
{{ $nickname }}
@php
$gigaxListId = $playerId
? (\Illuminate\Support\Facades\DB::table('users')->where('id', (int) $playerId)->value('gigax_id') ?? $playerId)
: null;
@endphp
@if($gigaxListId)
GIGAX ID #{{ $gigaxListId }}
@endif
@if(!$hasPlayed)
NOVO
@endif
Nível {{ $level }} · {{ $statusText }}
PONTOS
{{ number_format($points,0,',','.') }}
K/D
{{ number_format($kd,2,',','.') }}
V / D
{{ $wins }} / {{ $losses }}
PARTIDAS
{{ $matches }}
@empty
⌕
Nenhum jogador encontrado
Tente outro nickname ou limpe os filtros.
@endforelse
@if($pages > 1)
@endif
{{-- GIGAX_PLAYERS_ACTIONS_FIXED_V2 --}}
{{-- /GIGAX_PLAYERS_ACTIONS_FIXED_V2 --}}
@endsection
@push('styles')
@endpush
@push('scripts')
@endpush