{{--
Shared user form.
@param \App\Models\User|null $user Null when creating.
@param \Illuminate\Support\Collection $roles
--}}
@php($editing = isset($user))
@error('name')
{{ $message }}
@enderror
@error('email')
{{ $message }}
@enderror
@error('password')
{{ $message }}
@enderror
Mínimo de 8 caracteres, com letras e números.
@error('role_id')
{{ $message }}
@enderror
@if ($editing && auth()->id() === $user->id)
{{-- Mirrors UserPolicy::updateRole: changing your own role could strip
the very permission needed to undo the change. --}}
Você não pode alterar o seu próprio perfil de acesso.
{{-- An unchecked checkbox submits nothing, so without this hidden field
"active" would be absent from the payload and the `sometimes` rule
would skip it — deactivating a user would silently do nothing.
It is omitted when editing yourself, where the checkbox is disabled:
posting 0 there would attempt the very self-deactivation the policy
forbids. --}}
@unless ($editingSelf)
@endunless
active : true))
@if ($editingSelf) disabled @endif>
@if ($editingSelf)