PHP Classes

File: app/Actions/Fortify/UpdateUserPassword.php

Recommend this page to a friend!
  Classes of Thierry Feuzeu   Jaxon DB Admin   app/Actions/Fortify/UpdateUserPassword.php   Download  
File: app/Actions/Fortify/UpdateUserPassword.php
Role: Class source
Content typex: text/plain
Description: Class source
Class: Jaxon DB Admin
Web application to manage SQL of databases
Author: By
Last change: Update of app/Actions/Fortify/UpdateUserPassword.php
Date: 2 months ago
Size: 924 bytes
 

Contents

Class file image Download
<?php

namespace App\Actions\Fortify;

use
App\Models\User;
use
Illuminate\Support\Facades\Hash;
use
Illuminate\Support\Facades\Validator;
use
Laravel\Fortify\Contracts\UpdatesUserPasswords;

class
UpdateUserPassword implements UpdatesUserPasswords
{
    use
PasswordValidationRules;

   
/**
     * Validate and update the user's password.
     *
     * @param array<string, string> $input
     */
   
public function update(User $user, array $input): void
   
{
       
Validator::make($input, [
           
'current_password' => ['required', 'string', 'current_password:web'],
           
'password' => $this->passwordRules(),
        ], [
           
'current_password.current_password' => __('The provided password does not match your current password.'),
        ])->
validateWithBag('updatePassword');

       
$user->forceFill([
           
'password' => Hash::make($input['password']),
        ])->
save();
    }
}