-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Error upon submitting the /user/create form: "Unknown column 'password_confirmation" #10
Comments
Have you done a composer update lately? The model removes the password_confirmation field before the save. /**
* Ardent method overloading:
* Before save the user. Generate a confirmation
* code if is a new user.
*
* @param bool $forced Indicates whether the user is being saved forcefully
* @return bool
*/
public function beforeSave( $forced = false )
{
if ( empty($this->id) )
{
$this->confirmation_code = md5(microtime().static::$_app['config']->get('app.key'));
}
/*
* Remove password_confirmation field before save to
* database.
*/
if ( isset($this->password_confirmation) )
{
unset( $this->password_confirmation );
}
return true;
} https://github.com/Zizaco/confide/blob/master/src/Zizaco/Confide/ConfideUser.php |
@j20, If you override the method |
Hmm. I haven't overridden anything. My User.php model is empty. I've just followed the Confide instructions:
I suppose I can try Confide with a different L4 installation and see if it still happens. |
Please let me know if the error persists |
Sorry, I'm getting the same error when trying to create a new user. I set up a new Laravel 4 (beta 3) installation and downloaded the current version of Confide and set it up. I also tried using Confide's restful controller and restful route, but received the same error again.
This likely doesn't help much, but after some playing around, I've discovered that if I comment out Line 38 of UserController.php So I take it that you are able to create an account on your installation? |
Can you manually add a couple var_dumps() within the https://github.com/Zizaco/confide/blob/master/src/Zizaco/Confide/ConfideUser.php Something like this: public function beforeSave( $forced = false )
{
if ( empty($this->id) )
{
$this->confirmation_code = md5(microtime().static::$_app['config']->get('app.key'));
}
echo "password dump::";
var_dump($user->password_confirmation);
echo "pre isset/unset
";
/*
* Remove password_confirmation field before save to
* database.
*/
if ( isset($this->password_confirmation) )
{
unset( $this->password_confirmation );
}
echo "password::";
var_dump($user->password_confirmation);
echo "post isset / unset
";
die();
return true;
} Then post the results. |
Ok. I pasted those echo's and var_dump's into ConfideUser.php, but I get the same error message upon submission and do not see any of the echo'd output. It seems that beforeSave is not being run because I can use So I have to figure out why beforeSave() isn't being run. |
I'm sorry but I couldn't reproduce this error here. Can you please put a sample project with this error in github for us to examine? |
An upload of your exact files to github would be ideal as I cannot reproduce either. More detail could help as well. |
A fresh install of Laravel 4 beta 4 and Confide today has it working! I have no idea what was the cause. But thanks for helping troubleshoot it guys! |
Your welcome :) |
Welcome! |
Incase anyone ever comes across this again its caused by not extending the User model to: class User extends ConfideUser { |
Upon submitting the form to create a new user (/user/create), the following fatal error is returned:
and no new user is added to the database.
The text was updated successfully, but these errors were encountered: