vendredi 18 mai 2018

How to Ignore given id during validation

Do not down vote this question, I know it has been asked before but, I couldnt one any with working answer!

I'm trying to have a unique email, but ignore a given id during validation. Tried a few methods to get this done, here is two of them which were promising yet, did not work:

Validator::make($request->all(), [
     'username' => ['username', Rule::unique('user', 'username')->ignore($user->id)]
]);

another one:

'username' => 'required|max:30,',
Rule::unique('user')->ignore($user->id),

thanks for and help.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire