dimanche 12 septembre 2021

Check unique email with password not null in laravel

I have a user table where there are two fields email and password

 $validator = Validator::make($request->all(),[
            'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
            'password' => ['required', 'string', 'min:5', 'confirmed','min:8'],
            'password_confirmation' => ['min:8']
        ]);

I'm using unique field to check whether email is unique but i want to show message user already exist only if email already exist and password field not null, because i have a case if user is login through social media account then password is not saved and is null, so when user is trying to register through normal account then i want to update user fields.

Any Suggestion Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire