// method untuk insert data ke table d_rak
public function store(Request $request)
{
$data=new User();
$data->name=$request->get('name');
$data->username=$request->get('username');
$data->nip=$request->get('nip');
$data->level=$request->get('level');
$data->email=$request->get('email');
$data->password=$request->get('password');
$data->save();
return redirect ('/users')->with('alert-success','Berhasil Menambahkan Data!');
}
Asked
Active
Viewed 1,441 times
0

Yasin Patel
- 5,624
- 8
- 31
- 53

El shaa
- 109
- 2
- 8
-
1Hash::make($request->get('password')) – Yasin Patel Oct 30 '19 at 08:02
-
1Does this answer your question? [How to create a laravel hashed password](https://stackoverflow.com/questions/22846897/how-to-create-a-laravel-hashed-password) – Abhay Maurya Oct 30 '19 at 08:09
3 Answers
4
Try this
use Illuminate\Support\Facades\Hash;
$data->password= Hash::make($request->get('password'));

albus_severus
- 3,626
- 1
- 13
- 25
1
Simply use bcrypt
helper.
$data->password = bcrypt($request->get('password'));
or Hash
facade.
$data->password = Hash::make($request->get('password'));

Harun
- 1,137
- 1
- 9
- 7
0
For use in controller:
$request->user()->fill([
'password' => Hash::make($request->newPassword)
])->save();
And check if is the correct password
The check method allows you to verify that a given plain-text string corresponds to a given hash. However, if you are using the LoginController included with Laravel, you will probably not need to use this directly, as this controller automatically calls this method:
if (Hash::check('plain-text', $hashedPassword)) {
// The passwords match...
}

Danilo Mercado Oudalova
- 686
- 5
- 13