@extends('admin-layouts.master') @section('title', 'Edit User - ' . $user->name) @section('content')
@php $avatarConfig = match(true) { $user->hasRole('superadmin') => ['bg' => 'bg-danger', 'icon' => 'fa-crown'], $user->hasRole('supervisor') => ['bg' => 'bg-warning', 'icon' => 'fa-user-tie'], $user->hasRole('staff') => ['bg' => 'bg-info', 'icon' => 'fa-user-edit'], $user->hasRole('administrator') => ['bg' => 'bg-success', 'icon' => 'fa-user-cog'], $user->hasRole('guest') => ['bg' => 'bg-secondary', 'icon' => 'fa-user-clock'], default => ['bg' => 'bg-secondary', 'icon' => 'fa-user'] }; @endphp

Edit User

Modify user information and role assignments for {{ $user->name }}

@can('user.view') View Details @endcan Back to Users
@if(session('success'))
@endif @if(session('error'))
@endif @if($errors->any())
@endif
@csrf @method('PUT')
User Information
@if($user->hasRole('superadmin') && $user->id === auth()->id()) You cannot change your own username @else Unique identifier for login @error('username')
{{ $message }}
@enderror @endif
@error('name')
{{ $message }}
@enderror
Will be used for login and notifications @if($user->email_verified_at) Email verified {{ $user->email_verified_at->diffForHumans() }} @else Email not verified @endif @error('email')
{{ $message }}
@enderror
Change Password (Optional)
@error('password')
{{ $message }}
@enderror
Minimum 8 characters
@if($user->profile_photo)
Current Photo
@endif
@error('profile_photo')
{{ $message }}
@enderror
Max 2MB (JPEG, PNG, JPG)
{{ $user->created_at->format('M d, Y') }}
Account Created
{{ $user->roles->count() }}
Current Roles
{{ $user->email_verified_at ? 'Verified' : 'Pending' }}
Email Status
Manage Roles
@if($roles->count() > 0)
Main role for this user @error('primary_role_id')
{{ $message }}
@enderror
Select all roles for this user (including primary) @foreach($roles as $role) @php $roleConfig = match($role->name) { 'superadmin' => ['bg' => 'bg-danger', 'icon' => 'fa-crown'], 'supervisor' => ['bg' => 'bg-warning', 'icon' => 'fa-user-tie'], 'staff' => ['bg' => 'bg-info', 'icon' => 'fa-user-edit'], 'administrator' => ['bg' => 'bg-success', 'icon' => 'fa-user-cog'], 'guest' => ['bg' => 'bg-secondary', 'icon' => 'fa-user-clock'], default => ['bg' => 'bg-secondary', 'icon' => 'fa-user'] }; $isSuperadminProtected = $role->name === 'superadmin' && $user->hasRole('superadmin') && $user->id === auth()->id(); @endphp
id, old('roles', $userRoles)) ? 'checked' : '' }} {{ $isSuperadminProtected ? 'disabled' : '' }}>
@if($isSuperadminProtected) @endif @endforeach @if($user->hasRole('superadmin') && $user->id === auth()->id()) You cannot remove your own superadmin role @endif @error('roles')
{{ $message }}
@enderror
Selected Roles {{ count($userRoles) }}
@if(count($userRoles) > 0) @foreach($user->roles->take(3) as $role) {{ $role->display_name }} @endforeach @if($user->roles->count() > 3) ... and {{ $user->roles->count() - 3 }} more @endif @else No roles selected @endif
@else
No Roles Available

Please create roles first before editing users.

@endif
Cancel
@push('scripts') @endpush @endsection