Skip to content

Password default value not working SOLUTION! #5

@joukhar

Description

@joukhar

here is solution:
in Forms/Fields/ApplicationFields.php
removed default function because its not working
added controllable required from config
added default in dehydrateStateUsing

   if ($key == 'admin.password') {
                $applicationFields[] = TextInput::make('applications.' . $key)
                    ->required($value['required'])
                    ->label($value['label'])
                    ->password()
                    ->maxLength(255)
                    ->dehydrateStateUsing(
                        fn ($state) => !blank($state) ?
                            Hash::make($state) :
                            Hash::make($value['default'])
                    );
            } else {
                $applicationFields[] = TextInput::make('applications.' . $key)
                    ->label($value['label'])
                    ->required($value['required'])
                    ->rules($value['rules'])
                    ->default($value['default'] ?? '');
            }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions