mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-17 17:01:37 +00:00
26 lines
637 B
PHP
Executable File
26 lines
637 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Actions\User;
|
|
|
|
use Illuminate\Support\Facades\Hash;
|
|
use Illuminate\Support\Facades\Validator;
|
|
|
|
class UpdateUserPassword
|
|
{
|
|
/**
|
|
* Validate and update the user's password.
|
|
*/
|
|
public function update($user, array $input): void
|
|
{
|
|
Validator::make($input, [
|
|
'current_password' => ['required', 'string', 'current-password'],
|
|
'password' => ['required', 'string'],
|
|
'password_confirmation' => ['required', 'same:password'],
|
|
])->validate();
|
|
|
|
$user->forceFill([
|
|
'password' => Hash::make($input['password']),
|
|
])->save();
|
|
}
|
|
}
|