Zooniverse enforces validation at two layers: standard Laravel form validation applied in the controller before any database writes, and business logic checks that evaluate domain-specific constraints such as enclosure compatibility and capacity. This page documents every rule at both layers for enclosures and animals.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/raczkodavid/Zooniverse/llms.txt
Use this file to discover all available pages before exploring further.
Enclosure Validation
Creating an Enclosure
The following rules are applied inEnclosureController::store():
| Field | Rules | Notes |
|---|---|---|
name | required | Any non-empty string is accepted |
limit | required, integer, min:1 | Must be at least 1 |
feeding_time | required, date_format:H:i:s | Must be a full time string including seconds, e.g. 08:30:00 |
Updating an Enclosure
The rules inEnclosureController::update() are mostly the same, with one important difference for limit:
| Field | Rules | Notes |
|---|---|---|
name | required, string | |
limit | required, integer, min: max(1, current animal count) | Cannot be set below the number of animals currently in the enclosure |
feeding_time | required | Format is not re-validated on update |
The dynamic
min on limit prevents an admin from reducing the capacity below the enclosure’s current occupancy. For example, if an enclosure holds 4 animals, the limit cannot be set lower than 4.Animal Validation
Creating and Updating an Animal
The same validation rules are applied in bothAnimalController::store() and AnimalController::update():
| Field | Rules | Notes |
|---|---|---|
name | required, string | |
species | required, string | Free-form species name |
type | required, in:predator,herbivore | Controls the is_predator boolean stored in the database |
born_at | required, date, before:now, after:01-01-1900 | Must be a past date within a plausible range |
enclosure_id | required, exists:enclosures,id | The referenced enclosure must exist in the database |
The
type field is submitted as a string (predator or herbivore) and mapped to the boolean is_predator column on save: 'is_predator' => $validated['type'] === 'predator'.Business Logic Validations
Beyond form validation, the controllers enforce domain rules that cannot be expressed with standard Laravel validation rules alone.Enclosure Compatibility
Before adding or updating an animal, the system checks that the animal’s type matches the enclosure’s existing population:isPredatorEnclosure() method returns null when the enclosure is empty, which signals that either type is acceptable:
Enclosure Capacity
After the compatibility check, the system verifies the enclosure is not already full:Enclosure Deletion
An enclosure can only be deleted if it contains no animals:Restore Compatibility
When restoring an archived animal, the same compatibility and capacity logic applies. TheAnimal::isCompatibleWithEnclosure() method is used directly:
Animal::getValidEnclosures(), so only compatible, non-full enclosures are presented as options. Server-side validation still runs at submission time.