1
I have a question regarding the unique field validation in the Laravel.
I have two tables with no relationships (users
and companies
), both have a column email
.
I need to validate the field email
uniquely in the two different tables, that is, when registering the company I need to check if the email
exists in the table companies
and in the table users
.
I tried to do it in validation
'email' => 'required|unique:companies'
'email' => 'required|unique:users'
I did not succeed in this attempt. What is the best way to do this?