@extends('front.layouts.app') @section('content')

Explore Athletes / Teams

Discover and connect with top athletes and teams from around the world.

@if($currentRole === 'team') Teams @elseif($currentRole === 'athlete') Athletes @else Athletes & Teams @endif

@if($currentRole === 'team') Discover talented teams and explore their achievements, stats, and performance. @elseif($currentRole === 'athlete') Discover talented athletes and explore their skills, stats, and achievements. @else Discover talented athletes and teams and explore their skills, stats, and achievements. @endif
@if($data && (is_array($data) ? count($data) > 0 : $data->count() > 0)) @foreach($data as $user) @php // Detect user's actual role from their data $userRole = isset($user->role_title) ? \Illuminate\Support\Str::slug($user->role_title) : ''; // Get appropriate profile based on detected user role (not global $currentRole) $profile = ($userRole === 'team') ? $user->teamProfile : $user->athleteProfile; $primarySport = $user->sports->first(); // Avatar - get from accessor (returns array with 'original', 'thumb', etc.) $avatarData = $user->avatar ?? []; $avatar = is_array($avatarData) ? ($avatarData['original'] ?? asset('assets/images/thumb1.png')) : asset('assets/images/thumb1.png'); // Cover image $coverImage = ($user->profile_pic && isset($user->profile_pic->file_path)) ? $user->profile_pic->file_path : asset('assets/images/card-2.png'); // Get location $location = ''; if ($profile) { $locationParts = array_filter([ optional($profile->city)->city_name, optional($profile->state)->state_name, optional($profile->country)->country_name ]); $location = implode(', ', $locationParts); } // Get social link icon $socialIcon = null; if ($user->socialLinks && $user->socialLinks->count() > 0) { $firstLink = $user->socialLinks->first(); switch($firstLink->social_link_type) { case 1: $socialIcon = asset('front/assets/images/youtube.png'); break; case 2: $socialIcon = asset('front/assets/images/instagram.png'); break; case 3: $socialIcon = asset('front/assets/images/facebook.png'); break; } } // Get gender icon $genderIcon = $user->gender == 1 ? asset('front/assets/images/male.svg') : asset('front/assets/images/female.svg'); // Get sport info and icon from master_sports (use detected user role, not global currentRole) $sportName = ''; $sportIcon = asset('img/no-image.png'); // Default fallback $positionName = ''; if ($userRole === 'team' && $profile && $profile->sport) { $sportName = optional($profile->sport)->title ?? 'Team'; // Get sport icon from master_sports -> files table (image accessor returns array) $sportImageData = $profile->sport->image ?? []; if (is_array($sportImageData) && isset($sportImageData['original']) && is_string($sportImageData['original'])) { $sportIcon = $sportImageData['original']; } } elseif ($userRole === 'athlete' && $primarySport && $primarySport->sport) { // $primarySport is UserMasterSportMap, need to access ->sport $sportName = optional($primarySport->sport)->title ?? ''; // Get sport icon from master_sports -> files table (image accessor returns array) $sportImageData = optional($primarySport->sport)->image ?? []; if (is_array($sportImageData) && isset($sportImageData['original']) && is_string($sportImageData['original'])) { $sportIcon = $sportImageData['original']; } if ($profile && $profile->position) { $positionName = optional($profile->position)->title ?? ''; } } $bio = optional($profile)->athlete_bio ?? optional($profile)->team_bio_tagline ?? 'No bio available'; $schoolClub = optional($profile)->school_club_name ?? optional($profile)->team_club_name ?? 'N/A'; // Campaign summary samples (30 random options) $campaignSummaries = [ 'Road to State Finals – Raising $2,500 for training camp', 'Help Me Reach Nationals – Need $3,000 for travel and registration', 'Championship Dreams – Fundraising $5,000 for elite coaching', 'College Prep Journey – Raising $4,500 for showcase tournaments', 'Team Equipment Drive – Need $6,000 for new uniforms and gear', 'Summer Training Fund – Raising $2,000 for intensive camp', 'International Tournament – Need $8,000 for travel expenses', 'New Season Goals – Fundraising $3,500 for facility fees', 'Youth League Support – Raising $2,500 for community program', 'Athletic Scholarship Quest – Need $5,500 for combine training', 'Regional Competition Fund – Raising $4,000 for entry fees', 'Skills Development – Need $3,200 for specialized coaching', 'Team Tournament Tour – Fundraising $7,000 for multi-state travel', 'Olympic Dreams Begin – Raising $10,000 for elite training program', 'Next Level Performance – Need $4,800 for sports science support', 'Division 1 Ambitions – Raising $6,500 for recruiting exposure', 'Playoff Push 2024 – Fundraising $3,000 for playoff preparation', 'Youth Sports Initiative – Need $2,800 for program expansion', 'State Championship Run – Raising $5,200 for tournament costs', 'Athletic Excellence Program – Need $4,200 for year-round training', 'Community Team Building – Fundraising $3,600 for team development', 'Professional Aspirations – Raising $9,000 for pro-level coaching', 'Season Success Fund – Need $3,300 for competition expenses', 'Rising Star Campaign – Raising $4,700 for showcase participation', 'Athletic Dreams 2024 – Need $5,800 for comprehensive training', 'Tournament Victory Fund – Fundraising $4,100 for championship prep', 'Elite Athlete Development – Raising $7,500 for specialized program', 'Championship Season – Need $3,900 for complete season support', 'Future Champions Fund – Raising $5,400 for youth development', 'Competitive Edge Campaign – Need $6,200 for performance training' ]; // Demo campaign data (for demonstration purposes) $campaignSummary = $campaignSummaries[array_rand($campaignSummaries)]; $demoRaised = rand(1000, 50000); $demoGoal = rand(60000, 100000); $demoPercentage = round(($demoRaised / $demoGoal) * 100); $demoDaysLeft = rand(10, 90); @endphp @if($loop->first || $loop->iteration % 3 == 1)
@endif
{{ $user->full_name }}
{{ $sportName }}
{{ $user->full_name }} Gender
@if($sportName) {{ $sportName }} @if($positionName) – {{ $positionName }} @endif @endif
@if($socialIcon) @endif
Short Bio
{{ Str::limit($bio, 100) }}
@if($location)
{{ $location }}
@endif
School / Club {{ $schoolClub }}
Campaign Summary
{{ $campaignSummary }}
Raised : ${{ number_format($demoRaised) }}
{{ $demoPercentage }}%
Goal : ${{ number_format($demoGoal) }}
{{ $demoDaysLeft }} days left
@if($loop->iteration % 3 == 0 || $loop->last)
@endif @endforeach
{{ $data->links() }}
@else

No results found.

@endif
@if($data && (is_array($data) ? count($data) > 0 : $data->count() > 0))
@foreach($data as $user) @php // Detect user's actual role from their data $userRole = isset($user->role_title) ? \Illuminate\Support\Str::slug($user->role_title) : ''; // Get appropriate profile based on detected user role (not global $currentRole) $profile = ($userRole === 'team') ? $user->teamProfile : $user->athleteProfile; // Avatar - get from accessor (returns array with 'original', 'thumb', etc.) $avatarData = $user->avatar ?? []; $avatar = is_array($avatarData) ? ($avatarData['original'] ?? asset('front/assets/images/thumb1.png')) : asset('front/assets/images/thumb1.png'); // Build location string $location = ''; if ($profile) { $locationParts = array_filter([ optional($profile->city)->city_name, optional($profile->state)->state_name, optional($profile->country)->country_name ]); $location = implode(', ', $locationParts); } // Get primary sport info from user_master_sport_maps -> master_sports $primarySport = $user->sports->first(); $sportName = 'N/A'; $sportIcon = asset('front/assets/images/default-sport.png'); if ($primarySport && $primarySport->sport) { // $primarySport is UserMasterSportMap, access ->sport for MasterSport $sportName = optional($primarySport->sport)->title ?? 'N/A'; // Get sport icon from master_sports -> files table (image accessor returns array) $sportImageData = optional($primarySport->sport)->image ?? []; if (is_array($sportImageData) && isset($sportImageData['original']) && is_string($sportImageData['original'])) { $sportIcon = $sportImageData['original']; } } // Position for athletes (use detected user role, not global currentRole) $position = ''; if ($userRole === 'athlete' && $profile && $profile->position) { $position = ' - ' . optional($profile->position)->title; } // Gender icon $genderIcon = ($user->gender == 1) ? asset('front/assets/images/male.svg') : asset('front/assets/images/female.svg'); // Bio text $bio = optional($profile)->athlete_bio ?? optional($profile)->team_bio_tagline ?? 'No bio available'; // School/Club name $schoolClub = optional($profile)->school_club_name ?? optional($profile)->team_club_name ?? 'N/A'; // Get first social link for display $socialLink = $user->socialLinks->first(); $socialIcon = ''; if ($socialLink) { switch($socialLink->social_link_type) { case 1: // YouTube $socialIcon = asset('front/assets/images/youtube.png'); break; case 2: // Instagram $socialIcon = asset('front/assets/images/instagram.png'); break; case 3: // Facebook $socialIcon = asset('front/assets/images/facebook.png'); break; default: $socialIcon = asset('front/assets/images/link.png'); } } // Campaign summary samples (30 random options) $campaignSummaries = [ 'Road to State Finals – Raising $2,500 for training camp', 'Help Me Reach Nationals – Need $3,000 for travel and registration', 'Championship Dreams – Fundraising $5,000 for elite coaching', 'College Prep Journey – Raising $4,500 for showcase tournaments', 'Team Equipment Drive – Need $6,000 for new uniforms and gear', 'Summer Training Fund – Raising $2,000 for intensive camp', 'International Tournament – Need $8,000 for travel expenses', 'New Season Goals – Fundraising $3,500 for facility fees', 'Youth League Support – Raising $2,500 for community program', 'Athletic Scholarship Quest – Need $5,500 for combine training', 'Regional Competition Fund – Raising $4,000 for entry fees', 'Skills Development – Need $3,200 for specialized coaching', 'Team Tournament Tour – Fundraising $7,000 for multi-state travel', 'Olympic Dreams Begin – Raising $10,000 for elite training program', 'Next Level Performance – Need $4,800 for sports science support', 'Division 1 Ambitions – Raising $6,500 for recruiting exposure', 'Playoff Push 2024 – Fundraising $3,000 for playoff preparation', 'Youth Sports Initiative – Need $2,800 for program expansion', 'State Championship Run – Raising $5,200 for tournament costs', 'Athletic Excellence Program – Need $4,200 for year-round training', 'Community Team Building – Fundraising $3,600 for team development', 'Professional Aspirations – Raising $9,000 for pro-level coaching', 'Season Success Fund – Need $3,300 for competition expenses', 'Rising Star Campaign – Raising $4,700 for showcase participation', 'Athletic Dreams 2024 – Need $5,800 for comprehensive training', 'Tournament Victory Fund – Fundraising $4,100 for championship prep', 'Elite Athlete Development – Raising $7,500 for specialized program', 'Championship Season – Need $3,900 for complete season support', 'Future Champions Fund – Raising $5,400 for youth development', 'Competitive Edge Campaign – Need $6,200 for performance training' ]; // Demo campaign data (for demonstration purposes) $campaignSummary = $campaignSummaries[array_rand($campaignSummaries)]; $demoRaised = rand(1000, 50000); $demoGoal = rand(60000, 100000); $demoPercentage = round(($demoRaised / $demoGoal) * 100); $demoDaysLeft = rand(10, 90); @endphp
{{ $user->full_name }}

{{ $user->full_name }}

{{ $sportName }}{{ $position }}

@if($location)

{{ $location }}

@endif

Short Bio

{{ Str::limit($bio, 150) }}

@if($socialIcon) @endif

School / Club

{{ $schoolClub }}

Campaign Summary

{{ $campaignSummary }}

Raised : ${{ number_format($demoRaised) }}
{{ $demoPercentage }}%
Goal : ${{ number_format($demoGoal) }}
{{ $demoDaysLeft }} days left
View Profile
@endforeach
{{ $data->links() }}
@else

No results found.

@endif
@endsection @push('page_script') @endpush