Issue
I am using Laravel 5.2 and want to update user's account using validator.
I want to keep email field unique, but, if the user type his current email it will break. How can I update if the email is unique, except the user's own current email?
Solution
You can tell that to validators:
'email' => 'unique:users,email_address,'.$user->id
Check the docs, in section 'Forcing A Unique Rule To Ignore A Given ID'.
Answered By - Antonio Carlos Ribeiro Answer Checked By - David Marino (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.