Cole ships with a built-in feature-flag system called modules. Each module represents an optional functional area of the platform — such as attendance tracking or the academic agenda — that aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/iamalexis689725/cole/llms.txt
Use this file to discover all available pages before exploring further.
super-admin can enable or disable independently for each school tenant. This lets platform operators roll out features incrementally, or offer different feature tiers to different schools, without any code changes.
What is a Module?
A module is a named feature set identified by a shortcodigo (code key). Modules are global records in the modules table and are linked to individual tenants through the tenant_modules pivot table. The pivot carries a single boolean flag, activo, that controls whether the module is live for that school.
Tenant and Module Eloquent models are related through a belongsToMany that surfaces activo as a pivot attribute:
Available Modules
The following six modules are seeded byModuleSeeder using updateOrCreate, so re-running the seeder is safe:
| Code key | Display name | Description |
|---|---|---|
agenda | Agenda Académica | Academic agenda and task management for students |
asistencia | Asistencia | Classroom attendance recording and reporting |
circulares | Circulares | School circulars and announcements sent to users |
anecdotario | Anecdotario | Teacher anecdotal notes associated with students |
biblioteca | Biblioteca | Library resource catalogue and lending management |
estudiantes | Estudiantes | Extended student profile and enrolment management |
The CheckModule Middleware
The CheckModule middleware enforces module access on individual routes. It accepts the module’s codigo as a parameter and performs three checks in sequence before allowing the request to proceed.
super-admin bypass
If the authenticated user has the
super-admin role, the middleware immediately calls $next($request) and skips all remaining checks.Tenant presence check
The middleware resolves
$user->tenant. If the user has no tenant (for example, an improperly provisioned account), it returns 404 with a descriptive message.Module lookup
The middleware looks up the
Module record whose codigo matches the parameter passed to the middleware. An unknown codigo returns 404.Kernel.php under the alias module:
Applying Module Middleware to Routes
Pass the modulecodigo as an argument to the module middleware using colon syntax:
Inactive Module Response
When a tenant does not have a module assigned, or when the module exists on the tenant butactivo is false, the middleware returns an HTTP 403:
Managing Modules via the API
Only asuper-admin can assign, activate, or deactivate modules for a tenant. The relevant endpoints are under the /api/tenants/{tenantId}/modules prefix:
| Method | Endpoint | Description |
|---|---|---|
GET | /api/tenants/{tenantId}/modules | List all modules assigned to a tenant |
POST | /api/tenants/{tenantId}/modules | Assign a module to a tenant |
PATCH | /api/tenants/{tenantId}/modules/{moduleId}/activate | Set activo = true on the pivot |
PATCH | /api/tenants/{tenantId}/modules/{moduleId}/deactivate | Set activo = false on the pivot |
DELETE | /api/tenants/{tenantId}/modules/{moduleId} | Remove a module assignment entirely |
asistencia module to tenant 3:
biblioteca module on tenant 3: