Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel check old password

use IlluminateSupportFacadesHash;
$user = User::findOrFail($id);

/*
* Validate all input fields
*/
$request->validate([
    'password' => 'required',
    'new_password' => 'confirmed|max:8|different:password',
]);

if (Hash::check($request->password, $user->password)) { 
   $user->fill([
    'password' => Hash::make($request->new_password)
    ])->save();

    return redirect()->route('your.route')->with('success', 'Password changed');

} else {
    return redirect()->route('your.route')->with('error', 'Password does not match');
}
Comment

PREVIOUS NEXT
Code Example
Php :: How to display data from MySQL database into HTML table using PHP 
Php :: get country from ip php 
Php :: incorrect format parameter phpmyadmin xampp 
Php :: how change the languge of fie manager in laravel 
Php :: wsl continuous loading 
Php :: magento debug white page 
Php :: acf get sub field 
Php :: get parameter in php 
Php :: add a new column to existing table in a migration 
Php :: php replace 
Php :: laravel route is current route 
Php :: php get username from iis 
Php :: php run python script 
Php :: convert object to array php 
Php :: encryp with codeigniter 3 
Php :: how to json_encode an array in php unexpected identifier 
Php :: php substr remove last 4 characters 
Php :: view pdf file in a new tab in php 
Php :: xendit callback 
Php :: laravel base url 
Php :: exclude methods in resource route laravel 
Php :: php check weekday of date 
Php :: how to write json to file in php 
Php :: Composer detected issues in your platform: Your Composer dependencies require a PHP version "= 8.0.2". 
Php :: change font family in echo php 
Php :: php download rate limit 
Php :: laravel collection count 
Php :: explode function in laravel 
Php :: how to print count query in php 
Php :: Laravel Session using Global Session php function 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =