Unique validation

I have a model supporter. I need to when signing up check that a id_number does not exist on supporter and this is fine I get this but I also need to check if the id_number does not exist on members table, because a supporter could be upgraded to member we need to check if the member does not already exist.

so what i have is this

->unique(table: Supporter::class, ignoreRecord: true)
->unique(table: Member::class, ignoreRecord: true)

the supporter works fine but then the member is also looking for supporter id in members table which it does not have

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'supporters.id' in 'where clause'

select
count(*) as aggregate
from
members

where
id_number
= 1234
and
supporters
.
id
<> 2

how can i get this to work?
Was this page helpful?