@extends('layouts.admin') @section('title', ucfirst(auth()->user()->roles->first()->name ?? 'User') . ' Dashboard') @section('content')

Dashboard Overview

Updated: {{ date('d M, Y') }}
@can('user.view')
Total Users

{{ number_format($totalUsers) }}

@endcan @can('analytics')
Analytics

Logs

@endcan @can('role.view')
Active Roles

{{ $totalRoles }}

@endcan @can('permission.view')
Permissions

{{ $totalPermissions }}

@endcan
@can('analytics')
Recent System Activity
Live Feed
@forelse($recentActivity as $log) @php // Decode the JSON meta column into an array $meta = json_decode($log->meta, true); $userAgent = $meta['user_agent'] ?? 'Unknown Device'; // Simple logic to detect browser for the icon $browserIcon = 'bi-display'; // Default icon if (str_contains($userAgent, 'Mobile')) $browserIcon = 'bi-phone'; elseif (str_contains($userAgent, 'Postman')) $browserIcon = 'bi-terminal'; @endphp @empty @endforelse
User Action Device Time
{{ $log->name ?? 'System' }}
{{ $log->email }}
{{ ucfirst($log->action) }} {{-- Displaying IP and User Agent --}}
{{ Str::limit($userAgent, 30) }} {{-- Limits string length --}} IP: {{ $meta['ip'] ?? '0.0.0.0' }}
{{ $log->created_at->diffForHumans() }}
No recent activity found.
@endcan
@endsection