Possible to limit event registrations?

I plan to build a simple event registration form to register for an event. You can choose a given time slot and per slot there need to be a maximum of people that can register. I thought building it like the recipe Creating pages from frontend. So would it be possible to show the number of remaining seats and when the maximum (lets say 10) is reached, the slot gets deactivated? Thanks a lot for any tips!

Yes, you can simply wrap a condition around the registration-form snippet here: https://getkirby.com/docs/cookbook/forms/creating-pages-from-frontend#the-event-php-template

if($page->children()->count() < 10) {
  snippet('registration-form', compact('data'));

The same $page->children()->count() can also be used to show the number of remaining seats. You could even make the maximum number editable in the panel with a number field.

The time slots could be realized with a structure field. The users have to select one in the frontend and you can check with something like $page->children()->filterBy('slot', 'xy')->count().

Thanks a lot ! I could manage everything with count().