@extends('layouts.app') @section('title', 'Session Testing - Game World') @section('content')

Session Testing Dashboard

Current User

Name: {{ $user->name }}

Email: {{ $user->email }}

Role: @if($user->isAdmin()) Admin @else Student @endif

Class Levels: {{ $user->getClassLevelsString() }}

Current Session

Session ID: {{ Str::limit($currentSession, 20) }}...

IP Address: {{ request()->ip() }}

Browser: {{ request()->userAgent() ? Str::limit(request()->userAgent(), 30) : 'Unknown' }}...

Login Time: {{ $user->last_login_at ? $user->last_login_at->format('M d, Y H:i') : 'Unknown' }}

Session Rules
@if($user->isAdmin())

Admin Account: You can login from multiple devices and browsers simultaneously. No session restrictions apply to admin accounts.

@else

Student Account: You can only be logged in from one device/browser at a time. If you try to login from another device, you will be logged out from this one.

@endif
All Sessions for {{ $user->name }}
@if($userSessions->count() > 0)
@foreach($userSessions as $session) @endforeach
Session ID Device/Browser IP Address Last Activity Status Current
{{ Str::limit($session->session_id, 15) }}... @php $userAgent = $session->user_agent; if (strpos($userAgent, 'Chrome') !== false) { $device = 'Chrome Browser'; $icon = 'fab fa-chrome'; } elseif (strpos($userAgent, 'Firefox') !== false) { $device = 'Firefox Browser'; $icon = 'fab fa-firefox'; } elseif (strpos($userAgent, 'Safari') !== false) { $device = 'Safari Browser'; $icon = 'fab fa-safari'; } elseif (strpos($userAgent, 'Edge') !== false) { $device = 'Edge Browser'; $icon = 'fab fa-edge'; } else { $device = 'Unknown Browser'; $icon = 'fas fa-globe'; } @endphp {{ $device }} {{ $session->ip_address }} {{ $session->last_activity->diffForHumans() }} @if($session->is_active) Active @else Inactive @endif @if($session->session_id === $currentSession) This Session @else - @endif
@else

No sessions found.

@endif
How to Test Single Session
@if($user->isAdmin())
Admin Testing
  1. Open another browser (Chrome → Firefox)
  2. Login with the same admin account
  3. Result: Both sessions should work simultaneously
  4. Refresh this page to see multiple active sessions
@else
Student Testing
  1. Open another browser (Chrome → Firefox)
  2. Try to login with the same student account
  3. Result: You should see an error message
  4. If you force login, this session will be terminated
@endif
Go to Home @if($user->isAdmin()) Admin Panel @endif
@push('styles') @endpush @endsection