Here’s an example of how to use the Yii2 compare validator. The rules go in your model e.g. app/models/Participant.php. In this example, I’m ensuring that the participant_id and the invited_by id are not the same. I don’t want someone to be able to invite themselves. [php] public function rules() { return [ [‘participant_id’, ‘compare’,’compareAttribute’=>’invited_by’,’operator’=>’!=’,’message’=>’You cannot invite […]