How to check current password using hash check in Laravel?

Jul 26, 2022 . Admin


This article is focused on How to create a laravel hashed password. I would like to show you Hashing password in Laravel. I would like to show you laravel create password hash Code Example. you can see laravel hash check. Alright, let’s dive into the steps.

Hashing is the process of transforming a string of characters into a shorter fixed value or a key that represents the original string. Laravel uses the Hash facade which provides a secure way for storing passwords in a hashed manner.

Example:
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use App\Http\Controllers\Controller

class passwordController extends Controller{
   /**
      * Updating the password for the user.
      *
      * @param Request $request
      * @return Response
   */
   
   public function update(Request $request) {
      	$input = $request->all();
        $user = User::find(auth()->user()->id);


        if(!Hash::check($input['current_password'], $user->password)){
            dd('Passowrd is not match.');
        }else{
            dd('Update you password code');
        }
   }
}

It will help you....

#Laravel 9 #Laravel 8 #Laravel