Zizaco / confide

Confide is a authentication solution for Laravel 4
1.19k stars 258 forks source link

Error about array by save() #430

Closed matthijs-neijenhuijs closed 9 years ago

matthijs-neijenhuijs commented 10 years ago

This function in confide, insert a object in save. But in the ConfideUser.php it ask for a object?. I get the following error:

Argument 1 passed to User::save() must be of the type array, object given, called in

public function signup($input)
{
    $user = new User;

    $user->username = array_get($input, 'username');
    $user->email    = array_get($input, 'email');
    $user->password = array_get($input, 'password');

    // The password confirmation will be removed from model
    // before saving. This field will be used in Ardent's
    // auto validation.
    $user->password_confirmation = array_get($input, 'password_confirmation');

    // Generate a random confirmation code
    $user->confirmation_code     = md5(uniqid(mt_rand(), true));

    // Save if valid. Password field will be hashed before save
    $user->save($user);

    return $user;
}
matthijs-neijenhuijs commented 10 years ago

i found the solution, i need to use $user->save and not $user->save($user);

Strange thing is that in your example code it is this.