mercredi 4 septembre 2019

Laravel 5.8: After upgrade save method not working correctly

I upgraded my app from Laravel 5.6 to 5.8 and now my saveUser function not working and don't know why.


public function saveUser($name = '', $email = '', $password = ''){

    $id = request('id', 0);
    $name = request('name', $name);
    $email = request('email', $email);
    $password = request('pswrd', $password);

    if($id == 0){
        $saveUser = new User;
    } else {
        $saveUser = User::find($id);
    }
    $saveUser -> name = $name;
    $saveUser -> email = $email;
    if($password != ''){
        $saveUser -> password = bcrypt($password);
    }
    if($saveUser->save()){
        return 'success';
    } else {
        return 'error';
    }
}


It's output is success, but in the database there isn't any change



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire