I'm trying to figure out how to build a validation rule, and the simplest example I can give would be a class signup with students emails. I want each class to be able to have unique student emails signup, but I also want students to be able to sign up with the same email for multiple classes.
Class hasMany Students (id, name, limit)
Student belongsTo Class (id, email, class_id)
Example Scenario:
Class A, has student signup: [email protected] (If [email protected] signed up again for this class, it would not allow.)
Class B, could have student signup: [email protected] again since it's a different class.
So is there a way to use isUnique in combination with another rule, or is this a custom validator situation? Thanks!