Level 13
Hey,
- Maybe the schema does not match your data? Wrong data type, length etc.?
- Use the min validator: http://laravel.com/docs/4.2/validation#rule-min
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hey Guys,
I am passing form value to store function, works perfectly with out hash:
public function store()
{
$this->registrationForm->validate(Input::all());
$user = User::create(
Input::only('username', 'email', 'password')
);
Auth::login($user);
return Redirect::to('profile');
}
Now the moment I add hash like this
public function store()
{
$this->registrationForm->validate(Input::all());
$user = User::create(
Input::only('username', 'email', Hash::make('password'))
);
Auth::login($user);
return Redirect::to('profile');
}
1- I get the output of password as NULL in the database, what I am doing wrong?
2- In form validation, how to make password minimum length requirement?
Thanks in advance.
It's not working because you are hashing the key instead of hashing the actual password. Try using the following code
public function store()
{
$this->registrationForm->validate(Input::all());
$data = Input::only('username', 'email', 'password');
$data['password'] = Hash::make($data['password']);
$user = User::create($data);
Auth::login($user);
return Redirect::to('profile');
}
for password length you can use this in your $rules array
'password' => 'required|min:8',
Please or to participate in this conversation.