{{-- Shared access profile form. @param \App\Models\Role|null $role Null when creating. @param \Illuminate\Support\Collection $permissionGroups Permissions by module. --}} @php($editing = isset($role)) @php($selected = old('permissions', $editing ? $role->permissions->pluck('name')->all() : []))
@error('name')
{{ $message }}
@enderror @if ($editing && $role->is_system) {{-- The slug is frozen for system profiles: seeders and DefaultRoles resolve them by slug, so renaming it would spawn a duplicate on the next provisioning run. --}}
Perfil padrão do sistema. O nome pode ser ajustado, mas o identificador {{ $role->slug }} permanece.
@endif
@error('description')
{{ $message }}
@enderror
Permissões {{-- No hidden fallback field here: `permissions` and `permissions[]` would collide into the same PHP key. When every box is unchecked the field is simply absent, and RoleController defaults it to an empty array, which correctly revokes every permission. --}} @foreach ($permissionGroups as $module => $permissions)
{{-- O rótulo vem do MENU, não do slug: `text-capitalize` sobre `product-categories` produziria "Product-categories", e quem administra a arena teria de adivinhar que aquilo é a tela "Categorias" da Loja. Ver Permissions::moduleLabel(). --}}

{{ App\Support\Permissions::moduleLabel($module) }}

@foreach ($permissions as $permission)
name, $selected, true))>
@endforeach
@endforeach @error('permissions')
{{ $message }}
@enderror