Partidas no Lobby
Cards compactos com os dois times, jogadores e status da partida.
@extends('layouts.app') @push('styles') @endpush @section('title', 'Lobby - GIGAX ARENA') @section('page_title', 'Lobby') @php $waitingMatches = collect($activeLobbies ?? []); $runningMatches = collect($liveMatches ?? []); $lobbyMatches = $runningMatches ->concat($waitingMatches) ->unique(fn ($match) => ($match->status ?? '') . ':' . ($match->id ?? '')) ->values(); $totalMatches = $lobbyMatches->count(); $liveTotal = $runningMatches->count(); $waitingTotal = $waitingMatches->count(); // GIGAX: somente para exibir os comandos administrativos nos cards. $gxLobbyUserId = (int) (session('user_id') ?? auth()->id() ?? 0); $gxLobbyUserRole = $gxLobbyUserId ? (string) (\Illuminate\Support\Facades\DB::table('users')->where('id', $gxLobbyUserId)->value('role') ?? '') : ''; $gxLobbyIsAdmin = $gxLobbyUserRole === 'admin'; $avatarUrl = static function ($player) { $url = trim((string) ($player->avatar_url ?? '')); return $url !== '' ? $url : asset('default-avatar.png'); }; // Ranking lateral: usa a mesma base real de XP do projeto. $gxLobbyRanking = collect(); try { if (\Illuminate\Support\Facades\Schema::hasTable('gx_player_experience') && \Illuminate\Support\Facades\Schema::hasTable('users')) { $gxLobbyRanking = \Illuminate\Support\Facades\DB::table('gx_player_experience as x') ->join('users as u', 'u.id', '=', 'x.user_id') ->where('x.monthly_xp', '>', 0) ->orderByDesc('x.monthly_xp') ->orderBy('u.nickname') ->limit(10) ->get([ 'u.id as user_id', 'u.nickname', 'u.avatar_url', 'x.level', 'x.monthly_xp as xp', ]); } } catch (\Throwable $e) { $gxLobbyRanking = collect(); } $gxPlacementMatches = 0; $gxCurrentSkill = 1; try { if ($gxLobbyUserId > 0) { $gxCurrentSkill = (int) (\Illuminate\Support\Facades\DB::table('users')->where('id',$gxLobbyUserId)->value('skill_level') ?? 1); if (\Illuminate\Support\Facades\Schema::hasTable('mix_ranking_modes')) { $gxPlacementMatches = min(10, (int) (\Illuminate\Support\Facades\DB::table('mix_ranking_modes')->where('user_id',$gxLobbyUserId)->where('game_slug','crossfire')->where('queue_mode','casual')->value('matches_played') ?? 0)); } } } catch (\Throwable $e) {} @endphp @push('styles') @endpush @section('content')
Cards compactos com os dois times, jogadores e status da partida.