Support the ongoing development of Laravel.io →
Input Forms Validation

it's my form code for password..

{!! Form::open(['url'=>'c_adduser']) !!}
...
<div class="form-group">
	{!! Form::label('password', 'Password', ['class'=>'control-label']) !!}
	{!! Form::password('password', ['class' => 'form-control']); !!}
</div>
...

it's my "c_adduser"..

mod_user::create($req->all());
Session::flash('flash_message', 'User Data Saved');
return redirect('admin/adduser');

last, it's my mod_user..

class mod_user extends Model
{
	protected $table = 'tbl_user';
	protected $fillable = [
		'nama_user',
		'level_akses',
		'contact',
		'eMail',
		'password'
	];
	protected $guarded = ['status'];
}

i wanna ask how to encrypt value password to md5 before i insert it to MySQL??

and from migration, i have tbl_user (i create it for store user like admin, operator and user) and table users from laravel. so for what laravel give table users ?? it's my first time i used framework like laravel..

Last updated 3 years ago.
0

For you first question, again you can use mutators:

public function setPasswordAttribute($value){
   $this->attributes['password'] = md5($value);
}

and your second Q, laravel by default ships with a User model in your app/ directory. this model use some useful classes for authenticating, password reset and so on. By default laravel put a migration in your database/migrations directory. If you decide to don't use laravel default User you can remove the migration, and then migrate.

0

You should probably move away from md5 (you could use the laravel hash methods) - https://laravel.com/docs/5.3/hashing

0

Sign in to participate in this thread!

Eventy

Your banner here too?

DCHN04 dchn04 Joined 4 Oct 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.