Filter / query children pages for specific users

how can I fetch children pages with a field ‘allowedusers’, which has the value of a currently logged in user ??
This doesn’t work

$user_projects = $page->children()->filterBy('allowedusers', $kirby->user() ); 

I assume you are using a users field? This should work:

$user_projects = $page->children()->filter(function($child) {
  return $child->allowedusers()->toUsers()->has($kirby->user());

Yes, I am using a users field. The code works fine. Thanks.