Sign Up

Sign In

Forget Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

You must login to ask question.

Developers Map

Check Unique Email in laravel

  • 1

Laravel is most common framework now a days. It is easy to use. when you want email will be unique during register user.

Use Below Code :

$rules = [
’email’ => ’email|unique:TABLENAME;
];

if you want check unique value on update and want to escape specific id then use below code.

$rules = [
’email’ => ’email|unique:users,email,’ . $id
];

if you want email validation on a certain condition use below code.Below code compare two db column.if both have different values then email validation will be unable, but if they have same values the email validation will enabled.

$rules = [
‘FISRTCOLUMN’ => ‘unique:TABLENAME,FISRTCOLUMN,NULL,id,SECONDCOLUMN,’ .$id
];

Leave an answer

Leave an answer

Browse