From 6643c1e662c777ebd3586584a661d6c8355c5847 Mon Sep 17 00:00:00 2001 From: Fady Mondy Date: Sat, 28 Jan 2023 23:10:49 +0200 Subject: [PATCH] fix update password #12 --- src/Resources/UserResource.php | 6 +++++- stubs/UserResource.stub | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Resources/UserResource.php b/src/Resources/UserResource.php index 81139e4..471a71a 100644 --- a/src/Resources/UserResource.php +++ b/src/Resources/UserResource.php @@ -57,7 +57,11 @@ public static function form(Form $form): Form Forms\Components\TextInput::make('password')->label(trans('filament-user::user.resource.password')) ->password() ->maxLength(255) - ->dehydrateStateUsing(fn ($state) => !empty($state) ? Hash::make($state) : ""), + ->dehydrateStateUsing(static function ($state){ + if(!empty($state)){ + return Hash::make($state); + } + }), ]; if(config('filament-user.shield')){ diff --git a/stubs/UserResource.stub b/stubs/UserResource.stub index 686c84b..2e523bb 100644 --- a/stubs/UserResource.stub +++ b/stubs/UserResource.stub @@ -57,7 +57,11 @@ class UserResource extends Resource Forms\Components\TextInput::make('password')->label(trans('filament-user::user.resource.password')) ->password() ->maxLength(255) - ->dehydrateStateUsing(fn ($state) => !empty($state) ? Hash::make($state) : ""), + ->dehydrateStateUsing(static function ($state){ + if(!empty($state)){ + return Hash::make($state); + } + }), ]; if(config('filament-user.shield')){