@php $role = auth()->check() ? (auth()->user()->role ?? 'user') : 'user'; $isAdmin = ($role === 'admin'); $isSuper = ($role === 'super'); @endphp @if(session('ok'))
{{ session('ok') }}
@endif @if($errors->any())
{{ $errors->first() }}
@endif

ملاحظات

تنبيه مهم
- كلمة المرور الجديدة لازم تكون 8 أحرف أو أكثر.
{{-- ✅ إضافة مستخدم --}} @if($isAdmin)

إضافة مستخدم جديد

إنشاء مستخدم جديد
@csrf
@endif {{-- ✅ القائمة --}}

قائمة المستخدمين

إدارة الصلاحيات وكلمات المرور
@foreach($users as $u) {{-- ✅ الحالة --}} {{-- ✅ إجراءات: تفعيل/إيقاف + حذف --}} @endforeach @if(count($users) === 0) @endif
ID الاسم الإيميل الصلاحية الحالة تعديل الصلاحية اعادة كلمة المرور إجراءات
{{ $u->id }} {{ $u->name }} {{ $u->email }} {{ $roleLabels[$u->role ?? 'user'] ?? ($u->role ?? 'user') }} @if(($u->is_active ?? 1) == 1) ✅ فعال @else ⛔ موقوف @endif @if(!$isAdmin) @else @if(auth()->id() && (int)auth()->id() === (int)$u->id) لا يمكن تعديل صلاحيتك @elseif(($u->role ?? 'user') === 'admin') Admin (ثابت) @else
@csrf
@endif @endif
@if(!$isAdmin) @else
@csrf
@endif
@php $targetRole = $u->role ?? 'user'; $isSelf = auth()->id() && ((int)auth()->id() === (int)$u->id); $canToggle = false; if(!$isSelf && $targetRole !== 'admin'){ if($isAdmin) $canToggle = true; if($isSuper && $targetRole === 'user') $canToggle = true; } $canDelete = ($isAdmin && !$isSelf && $targetRole !== 'admin'); @endphp
@if($canToggle)
@csrf @php $active = ((int)($u->is_active ?? 1) === 1); @endphp
@else @endif @if($canDelete)
@csrf
@endif
لا يوجد مستخدمين