I know there are many questions about something similar, but I couldn't apply any solution to my problem.
I'm using Laravel with Confide, which uses Ardent to validate.
I don't have any problem saving users, password_confirmation is removed when inserted to the database (as it should) and users are inserted correctly.
The problem comes when trying to UPDATE a user. If I try to validate the user, I get an error saying that user is not unique:
public function storeProfile()
{
$user = $this->currentUser;
$user->password = Input::get( 'password' );
$user->password_confirmation = Input::get( 'password_confirmation' );
//$user->updateUniques();
$user->save();
dd($user->errors()->all());
}
string (31) "username is not unique"
string (28) "email is not unique"
If I try with $user->updateUniques() (as I saw in another question here in SO as a possible solution), it doesn't complain about uniqueness, but about password_confirmation not being present in the DB (so it's NOT removing it prior to inserting it).
public function storeProfile()
{
$user = $this->currentUser;
$user->password = Input::get( 'password' );
$user->password_confirmation = Input::get( 'password_confirmation' );
$user->updateUniques();
dd($user->errors()->all());
}
Column not found: 1054 Unknown column 'password_confirmation' in 'field list' (SQL: update `users` set `password` = y$wyNl2xMNJqL0mY4X766EfOvO.IKICyDfXckS1cas1Psj1TLwpJZWu, `updated_at` = 2014-03-07 17:13:04, `password_confirmation` = 123456 where `id` = 1)
I've tried with
public $autoPurgeRedundantAttributes = true;
public $forceEntityHydrationFromInput = false;
public $autoHydrateEntityFromInput = false;
As I saw in Laravel/Ardent/User model editing + saving but it's not working either. Thanks in advance for your help.