How modify rule for unique() when it must be unique if another field eg group are the same?

I have a house that belongs to a villege. In the same villege house_no must be unique but in different villege house_no can be the same. I tried to use ->unique( modifyRuleUsing: fn() =>...) but I don't know how to set this up. Please advise. #unique #✅┊rules
Solution:
->unique(ignoreRecord: true, modifyRuleUsing: fn ($rule, Get $get) => $rule->where('property_type_id', $get('property_type_id'))),...
Jump to solution
1 Reply
Solution
zenepay
zenepay2mo ago
->unique(ignoreRecord: true, modifyRuleUsing: fn ($rule, Get $get) => $rule->where('property_type_id', $get('property_type_id'))),