@extends('layouts.app') @section('title','Active Hotspot Users — BlueBando v3') @section('content') @php // formatter function bb_format_bytes($bytes) { $bytes = (float)$bytes; if ($bytes < 1024) return $bytes.' B'; if ($bytes < 1048576) return round($bytes/1024,2).' KB'; if ($bytes < 1073741824) return round($bytes/1048576,2).' MB'; if ($bytes < 1099511627776) return round($bytes/1073741824,2).' GB'; return round($bytes/1099511627776,2).' TB'; } $count = is_array($sessions) ? count($sessions) : 0; // compute max traffic for bar + chart $maxTraffic = 0; foreach ($sessions as $tmp) { $t = (int)($tmp['_traffic'] ?? 0); if ($t > $maxTraffic) $maxTraffic = $t; } $maxTraffic = $maxTraffic ?: 1; $routerId = optional($currentRouter)->id; @endphp

Hotspot Active

Live hotspot sessions for {{ $currentRouter?->name ?? '—' }}
Export CSV
Hotspot Active • {{ $count }} active {{ \Illuminate\Support\Str::plural('session',$count) }} • sorted by {{ strtoupper($sort) }}
Auto refresh every 30 seconds.
@csrf
Last refresh: {{ now()->format('Y-m-d H:i:s') }}
{{-- SIMPLE TOP TALKERS CHART --}} @if($count > 0) @php $topTalkers = collect($sessions) ->sortByDesc('_traffic') ->take(8) ->map(function($s){ return [ 'user' => $s['user'] ?? $s['name'] ?? '-', 'traffic' => (int)($s['_traffic'] ?? 0), ]; })->values()->all(); $chartMax = 0; foreach ($topTalkers as $tt) { if ($tt['traffic'] > $chartMax) $chartMax = $tt['traffic']; } $chartMax = $chartMax ?: 1; @endphp
Top talkers (Bytes In + Out)
@foreach($topTalkers as $tt) @php $h = max(8, ($tt['traffic'] / $chartMax) * 70); @endphp
{{ $tt['user'] }}
@endforeach
@endif @if ($count > 0)
@foreach($sessions as $s) @php $server = $s['server'] ?? $s['server-name'] ?? 'hotspot1'; $user = $s['user'] ?? $s['name'] ?? ''; $address = $s['address'] ?? ''; $mac = $s['mac-address'] ?? $s['mac'] ?? ''; $uptime = $s['uptime'] ?? '-'; $bytesIn = (int)($s['_bytes_in'] ?? 0); $bytesOut = (int)($s['_bytes_out'] ?? 0); $trafficBytes = (int)($s['_traffic'] ?? 0); $trafficPct = min(100, ($trafficBytes / $maxTraffic) * 100); $timeLeft = $s['session-time-left'] ?? $s['time_left'] ?? '-'; $loginBy = $s['login-by'] ?? ''; $comment = $s['comment'] ?? ''; $id = $s['.id'] ?? $s['id'] ?? null; @endphp @endforeach
Server User Address MAC Address Uptime Bytes In Bytes Out Traffic Time Left Login By Actions Comment
{{ $server }} {{ $user }} {{ $address }} {{ $mac }} {{ $uptime }} {{ bb_format_bytes($bytesIn) }} {{ bb_format_bytes($bytesOut) }}
{{ bb_format_bytes($trafficBytes) }}
{{ $timeLeft }} @if($loginBy) {{ $loginBy }} @endif
{{-- Kick --}} @if($id)
@csrf
@endif {{-- Kick by MAC --}} @if($mac)
@csrf
@endif {{-- Disable user --}} @if($user)
@csrf
@endif
{{ $comment }}
@else
No active hotspot users.
@endif
{{-- AUTO REFRESH EVERY 30 SECONDS --}} @endsection