xxxxxxxxxx
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
class PasswordController extends Controller
{
/**
* Update the password for the user.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function update(Request $request)
{
// Validate the new password length...
$request->user()->fill([
'password' => Hash::make($request->newPassword)
])->save();
}
}
xxxxxxxxxx
use Illuminate\Support\Facades\Hash;
Hash::make($newPassword);
if (Hash::check('plain-text', $hashedPassword)) {
// The passwords match...
}
xxxxxxxxxx
//pass your password to following function
bcrypt('12343');
//or use following method
use Illuminate\Support\Facades\Hash;
Hash::make('password');
xxxxxxxxxx
use Illuminate\Support\Facades\Hash;
$plainPassword = 'password123'; // Plain-text password entered by the user
$hashedPassword = '$2y$10$APKoWgSopA/WrqUKwfuEFeShQ2EJMz9Oa0XPWISAolMpv2IBOqtiK'; // Stored hashed password
if (Hash::check($plainPassword, $hashedPassword)) {
echo "Passwords match!";
} else {
echo "Passwords do not match.";
}
xxxxxxxxxx
$data = User::find($id);
if( ! Hash::check( $data->password , Input::get('currPassword') ) )
{
return Redirect::to('/admin/profile')
->with('message', 'Current Password Error !')
->withInput();
}
xxxxxxxxxx
use Illuminate\Support\Facades\Hash;
$hashed = Hash::make('password', [
'memory' => 1024,
'time' => 2,
'threads' => 2,
]);
xxxxxxxxxx
$password = Input::get('passwordformfield'); // password is form field
$hashed = Hash::make($password);
xxxxxxxxxx
$data = User::find($id);
if( ! Hash::check( Input::get('currPassword') , $data->password ) )
{
return Redirect::to('/admin/profile')
->with('message', 'Current Password Error !')
->withInput();
}