Skip to main content

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.

Enclosures are the core organisational unit in Zooniverse. Each enclosure holds a defined number of animals of a single type — either all predators or all herbivores — and has a scheduled daily feeding time. Admins manage the full lifecycle of enclosures, while caretakers can browse and view only the enclosures they have been assigned to.

What is an enclosure?

An enclosure record contains three fields stored in the enclosures database table:
FieldTypeDescription
namestringA human-readable label for the enclosure.
limitintegerThe maximum number of animals the enclosure can hold.
feeding_timetime (H:i:s)The daily feeding time for the enclosure’s animals.
The enclosure also tracks its current type (predator or herbivore) implicitly through the is_predator flag on the animals it contains. An empty enclosure has no type and accepts either kind.

Browsing enclosures

Navigate to Enclosures in the main navigation to see the enclosure list. Results are ordered alphabetically by name and paginated at 5 per page.
Admins see every enclosure in the system. Caretakers see only the enclosures they have been assigned to.
The list table shows:
  • Enclosure Name
  • Animal Limit — the configured maximum
  • Current Animal Count — the live count of animals in the enclosure
  • Actions — Show (all users), Edit and Delete (admins only)

Creating an enclosure

Only admins can create enclosures.
1

Open the create form

Click the Create Enclosure button on the enclosures list page. This loads the enclosure form at GET /enclosures/create.
2

Fill in the fields

Complete all three required fields:
  • Enclosure Name — any descriptive string (e.g. "Savannah North").
  • Animal Limit — a positive integer (min:1). This sets the maximum capacity.
  • Feeding Time — a time value in H:i:s format (e.g. 08:30:00). The browser time picker with step="1" is used in the UI.
3

Submit

Click Create Enclosure. The server validates the input and, on success, stores the record and redirects to the enclosure list.

Validation rules (create)

'name'         => 'required',
'limit'        => 'required|integer|min:1',
'feeding_time' => 'required|date_format:H:i:s',
All three fields are required. Submitting the form with any field missing will return validation errors displayed inline next to the relevant input.

Viewing enclosure details

Click Show on any enclosure row to open the detail page at GET /enclosures/{id}. The detail view displays:
  • Enclosure Name, Animal Limit, Current Animal Count
  • A danger alert if the enclosure currently holds predator animals
  • A list of all animals in the enclosure, each showing name, species, birthdate, and an optional photo
Animals on the detail page are sorted first by species (ascending) then by born_at (ascending), making it easy to spot all members of the same species grouped together and ordered from oldest to youngest.
Admins also see Edit and Archive buttons for each animal directly from this view.

Editing an enclosure

Only admins can edit enclosures. Navigate to GET /enclosures/{id}/edit or click Edit in the list. The edit form is identical to the create form but also includes a Select Caretakers button that opens a modal listing all registered users. Check or uncheck users to assign or unassign them from this enclosure.
1

Update name, limit, or feeding time

Modify any of the three main fields as needed and submit the form.
2

Assign caretakers

Click Select Caretakers, check the users who should have access to this enclosure, then close the modal. Caretaker assignments are synced (not appended) on every save — unchecked users lose access immediately.
3

Submit

Click Edit Enclosure. The server validates the data, saves changes, syncs caretaker assignments via the pivot table, and redirects to the enclosure list.

Validation rules (update)

'name'         => 'required|string',
'limit'        => 'required|integer|min:' . max(1, $enclosure->animals->count()),
'feeding_time' => 'required',
The limit cannot be set below the enclosure’s current animal count. For example, if 4 animals are present, the minimum accepted value for limit is 4. Attempting to set a lower value will return a validation error.
Caretaker assignments use sync(), which replaces the entire set on each save. If you open the edit form and submit without opening the caretaker modal, all existing assignments are cleared. Always review the caretaker selection before saving.

Deleting an enclosure

Click Delete in the enclosure list row. This sends a DELETE /enclosures/{id} request.
Deletion is only permitted when the enclosure contains zero animals. If any animals remain, the server redirects back to the list and displays an error message indicating the enclosure name and current animal count. Remove or archive all animals first before deleting.
When the enclosure is empty:
  1. All caretaker assignments are removed from the pivot table (detach).
  2. The enclosure record is permanently deleted from the database.

Capacity and type tracking

Capacity

The isFull() method on the Enclosure model compares the current animal count against the limit:
public function isFull(): bool
{
    return $this->animals->count() >= $this->limit;
}
This check runs when adding or restoring animals. A full enclosure rejects new animals with an error.

Predator / herbivore type

The isPredatorEnclosure() method determines the enclosure’s current type:
public function isPredatorEnclosure(): ?bool
{
    if ($this->animals->isEmpty())
        return null; // both types accepted

    return $this->animals->first()->is_predator;
}
A null return value means the enclosure is empty and accepts either type. Once the first animal is placed, all subsequent animals must match that type. The enclosure detail page shows a visible danger alert when the enclosure holds predators.

Build docs developers (and LLMs) love