Laravel 5 Unique Email Validation Example

The problem with the default check for unique email is that when you update a record and use the same form request as create (which is common). The user your trying to update’s email is already in the database and hence laravel will report that the email already exists when you try to save the user. This is expected behavior and this is a way around it for keeping the validation for email unique except for current updated records. We simply so a check to see if the email exists, if it doesn’t add the unique validation rule and if it does (for the user) then ignore unique.


Sam Deering

Sam Deering is a web developer from England (currently living in Australia). In his spare time he enjoys coding, playing chess, reading and investing.

Leave a Reply

Your email address will not be published. Required fields are marked *