@extends('layouts.admin') @section('title', 'User Management') @section('subtitle', 'Provision and manage all user accounts') @section('content')
| User | Role | Status | Actions |
|---|---|---|---|
|
{{ strtoupper(substr($user->name, 0, 1)) }}
{{ $user->name }} {{ $user->email }} |
@php $roleColors = [ 'admin' => 'bg-purple-100 text-purple-700', 'manager' => 'bg-indigo-100 text-indigo-700', 'staff' => 'bg-blue-100 text-blue-700', 'editor' => 'bg-blue-100 text-blue-700', 'user' => 'bg-slate-100 text-slate-600' ]; @endphp {{ $user->role }} | {{ $user->is_active ? 'Active' : 'Disabled' }} |
@if(auth()->user()->role !== 'admin' && $user->role === 'admin')
Protected
@else
@php
$canImpersonate = false;
if ($user->id !== auth()->id()) {
if (auth()->user()->role === 'admin') {
$canImpersonate = ($user->role !== 'admin');
} elseif (auth()->user()->role === 'manager') {
$canImpersonate = in_array($user->role, ['user', 'staff', 'editor']);
}
}
@endphp
@if($canImpersonate)
Login as
@endif
@if($user->id !== auth()->id())
@endif
@endif
|