Rules from two tables

I want to apply isUnique from two table class.

‘This person Id Number already exists.’

The above code checks is unique for single table class in which it is defined.

is this still your Generic Custom Validation question?


Its another one.
And I will share the generic validation updates on Generic Custom Validaton Page node.

We assume that both tables are related then you can use something like:

$rules->add($rules->isUnique(['person_id', 'group_id']));


If it’s not related you have to use custom validator to do the job.

I wanted something like this
$rules->add($rules->isUnique([‘Table1.person_id’, ‘Table2.person_id’]));

Person_id is should be unique in either of the table.