I have a question regarding the unique field validation in Laravel.
I have two tables without relationships ( users
and companies
), both have a email
column.
I need to validate the email
field uniquely in the two distinct tables, ie at the time of registering the company I need to check that email
exists in the companies
table and in the users
table. p>
I tried to do this in the validation
'email' => 'required|unique:companies'
'email' => 'required|unique:users'
I did not succeed in this attempt. What is the best way to do this?