I have the following validation, Where i am trying to check the email in two tables :
$validator = Validator::make($request->all(),
[
'email' => "exists:users,email|exists:user_company,company_email"
]);
But it only works for one table and that is the users table.
Is there anyway around it ?
There is option to add custom validation rules in laravel. Read about this here Laravel Custom Rules
For example:
$validator = Validator::make($request->all(), [
'email' => ["exists:users,email", function($attribute, $value, $fail) {
/* Custom Validation code */
},],
]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With