@php $isSuper = (int) $admin->role_id === 2; $isActive = (int) $admin->active === 1; $lockRole = $isSelf || ($isSuper && $isLastSuper); // can't demote self / last super $lockDisable = $isSelf || ($isActive && $isSuper && $isLastSuper); @endphp
You can't change your own role or disable your own account.
@elseif ($isSuper && $isLastSuper)Last active super-admin — promote another before changing this one.
@endif