familles-eleves

Documents family, guardian, and student management rules in the Toollab Laravel application.

Updated May 5, 2025
One-click install
npx skills add https://github.com/sebauvray/toollab-api --skill familles-eleves-sebauvray
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: familles-eleves
Source: https://github.com/sebauvray/toollab-api/tree/main/.claude/skills/familles-eleves
Command: npx skills add https://github.com/sebauvray/toollab-api --skill familles-eleves-sebauvray

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers modifying family, guardian, or student features in Toollab risk breaking subtle business rules: the polymorphic User/UserRole identity model, the callerCanAccessFamily access gate, enrollment replace semantics, and irreversible deletion behaviors. This Skill consolidates those rules so changes stay consistent with the existing codebase. ## Core Features & Use Cases - Identity model reference: Explains that students are Users with a polymorphic UserRole on a Family, contact data lives in key-value user_infos, and one person can be both guardian and student (requiring deduplication). - Endpoint and gate documentation: Covers FamilyController routes, the reusable callerCanAccessFamily gate, enrollment via StudentClassroomController with the replace pattern, and family deletion with 409 blockers and year-scoped trash. - UI screen specifications: Details the family list, family detail page, and class selection page including gender-based class filtering, capacity gauges, and known bugs to avoid. - Use Case: When asked to add a field to the student edit form, consult this Skill to learn that student data lives in user_infos key-value pairs, that first_name is nullable, and that deleting a student is irreversible. ## Quick Start Ask the AI to modify a family or student feature in Toollab, such as adding a guardian to a family, and it will apply the identity model, gate, and endpoint rules from this Skill.

Frequently Asked Questions about familles-eleves

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How are students and families modeled in this Laravel application?▼

Students are Users carrying a polymorphic UserRole with slug student attached to a Family; there is no students table. Families have no name field and are labeled by their guardians. Contact details live in a key-value user_infos table.

How does the callerCanAccessFamily authorization gate work?▼

callerCanAccessFamily is a public static method on FamilyController that grants access to super-admins, school staff (director, admin, registar), and family members, returning 403 otherwise. It is reused by PaiementController and StudentClassroomController and must not be duplicated.

How does student class enrollment work with the replace pattern?▼

The enroll endpoint runs in a transaction with a classroom lock, checks capacity and duplicates, then deletes any existing active enrollment on the same cursus and type before creating the new StudentClassroom with a tarif snapshot and a classroom-scoped UserRole.

Why is deleting a student irreversible in this system?▼

The student DELETE endpoint removes the user's user_infos, all user_roles across every family and school, and the User record itself. Because a guardian can also be a student, the UI hides the delete button for students who are also guardians.

Can a deleted family be restored after the school year closes?▼

No. The trash is bounded to the consulted school year via the deleted_at date, so a family deleted during a year that is now closed is no longer restorable. Restoration also does not re-enroll students in classes.

Does the backend enforce gender-based class filtering?▼

No. Gender filtering of classes is implemented only in the frontend shouldShowClass function; the enroll API accepts any combination. Directors and admins see all classes while other roles see only gender-compatible ones.