I have a table in which I am trying to store email addresses. These email addresses will be saved using user_id .
For example, in the email_list table
|ID | user_id | email | ............................... | 1 | 101 | john@gmail.com | ............................... | 2 | 102 | john@gmail.com |
In the table above, you can see that the same email addresses are stored with different user_id , which is what I'm trying to do.
I am currently trying to do a simple laravel check as follows.
'email' => 'required|unique:email_list|email',
So, is there a way to check for existing email addresses if the string has the same user_id ? I am using laravel 5.2. I would appreciate if someone leads me. Thanks you
Edited after 3 hours
I also add the same question on github as issue . The person says that I need to create my own validation rule.
php laravel laravel-5 laravel-validation
Ayaz Shah Sep 20 '16 at 10:21 2016-09-20 10:21
source share