@extends('admin.layout') @section('title', 'Users') @php $adminNeedsOtp = auth()->user()->two_factor_enabled && (! session('admin_2fa_verified_at') || now()->timestamp - session('admin_2fa_verified_at') >= 1800); $totalUsers = \App\Models\User::count(); $totalAdmins = \App\Models\User::whereIn('role', ['admin','super_admin'])->count(); $newThisWeek = \App\Models\User::where('created_at', '>=', now()->subDays(7))->count(); $unverified = \App\Models\User::whereNull('email_verified_at')->count(); @endphp @section('extra_styles') @endsection @section('content')

Users

Dashboard
{{-- Alerts --}} @if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif {{-- Stats --}}
{{ number_format($totalUsers) }}
Total users
{{ $totalAdmins }}
Admins
{{ $newThisWeek }}
New this week
{{ $unverified }}
Unverified
{{-- Filter --}}
@if(request()->hasAny(['search','role','sort'])) Clear @endif
{{-- Table --}}
Members {{ $users->total() ?? $users->count() }}
Click a row for actions
@forelse($users as $user) {{-- Identity --}} {{-- Role --}} {{-- Status --}} {{-- Videos --}} {{-- Likes --}} {{-- Shares --}} {{-- Joined --}} @empty @endforelse
User Role Status Videos Likes Shares Joined
{{ $user->name }}
{{ $user->name }} @if($user->id === auth()->id()) you @endif
{{ $user->email }}
@if($user->role === 'super_admin')
Super Admin
@elseif($user->role === 'admin')
Admin
@else
User
@endif
@if($user->email_verified_at)
Verified
@else
Pending
@endif
{{ $user->videos->count() }}
videos
@php $videoIds = $user->videos->pluck('id'); @endphp
{{ number_format(\DB::table('video_likes')->whereIn('video_id', $videoIds)->count()) }}
likes
{{ number_format(\DB::table('video_shares')->whereIn('video_id', $videoIds)->count()) }}
shares
{{ $user->created_at->format('M d, Y') }}
{{ $user->created_at->diffForHumans() }}

No users found

Try adjusting your search or filter criteria

@if($users instanceof \Illuminate\Pagination\LengthAwarePaginator && $users->hasPages())
{{ $users->onEachSide(1)->links() }}
@endif
{{-- Row action dropdown --}}
{{-- Delete dialog --}}
Delete User

You are about to permanently delete .

All videos uploaded by this user will also be deleted. This cannot be undone.
@if($adminNeedsOtp)
@endif
@endsection @section('scripts') @endsection