F
Filament7mo ago
Vp

hint action random data in form input

I am trying to create a reset password, the new password will auto generated on modal pop-up, when they click "refresh" it will change the password string (random). What I did: Auto generated password is done but I am stuck on refresh (hint action) My code:
Tables\Actions\Action::make('resetPassword')
->requiresConfirmation()
->fillForm([
'password' => Str::random(12),
])
->form([
Forms\Components\TextInput::make('password')
->required()
->hintAction(
Action::make('refresh')
->hiddenLabel()
->icon('heroicon-o-arrow-path')
->action(function (array $data) {
dd($data); // how to make random 'password' again?
})
)
])
Tables\Actions\Action::make('resetPassword')
->requiresConfirmation()
->fillForm([
'password' => Str::random(12),
])
->form([
Forms\Components\TextInput::make('password')
->required()
->hintAction(
Action::make('refresh')
->hiddenLabel()
->icon('heroicon-o-arrow-path')
->action(function (array $data) {
dd($data); // how to make random 'password' again?
})
)
])
How can I change the password value after clicking refresh (hintAction)
Solution:
I use set and now it's working
Jump to solution
1 Reply
Solution
Vp
Vp7mo ago
I use set and now it's working