I’m attempting to create a form validator where I aim to verify whether the post associated with the InternID (handset) contains a properly formatted email address.
'projectemail' => function ($values) {
$projectID = $values['projectid'];
$email = $values['email'];
$submission = ($p = kirby()->site()->index($drafts = true)->filterBy('template', 'post')->findBy('InternID', $projectID)) ? $p->Email() : null;
return V::in($email, [$submission]);
},
My rule is.
$rules = [
"projectemail" => [
"projectemail",
[$data['projectid'], $data['email']]
]
];