Skip to main content

Documentation 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.

Cole is a multi-tenant school management API built on Laravel 9. Before any school can start managing periods, grades, or attendance, you need to configure the environment, run migrations, seed the required roles and modules, and create your first super-admin account. This guide walks through every step in the correct order.

Environment Configuration

Copy .env.example to .env and fill in the required values. The most critical sections are described below.

Application Keys

APP_NAME=Cole
APP_ENV=production
APP_KEY=                         # Generated by: php artisan key:generate
APP_DEBUG=false
APP_URL=https://api.yourschool.com
Never run with APP_DEBUG=true in production. Debug mode exposes stack traces and internal configuration details in HTTP error responses.

Database

Cole requires a MySQL database. Create the database first, then configure the connection:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=cole_production
DB_USERNAME=cole_user
DB_PASSWORD=your_secure_password

Filesystem and Storage

Cole uses the filesystem to store tenant logos and agenda file attachments uploaded via the API. The FILESYSTEM_DISK variable controls which driver is used.
FILESYSTEM_DISK=local   # Use 'public' to serve files via /storage, or 's3' for AWS
For local/public storage you will also need to create the symlink (see Storage Symlink below). For S3, fill in the AWS credentials block:
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

Queue Driver

Cole dispatches background jobs for certain operations. The default sync driver processes jobs inline within the request, which is fine for development. In production, use a real queue backend so the HTTP request returns immediately.
QUEUE_CONNECTION=sync       # local/dev
# QUEUE_CONNECTION=redis    # production recommendation
If you switch to redis, also set:
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
Then start a queue worker:
php artisan queue:work --tries=3

Running Migrations

With the database credentials in place, run all migrations to create Cole’s schema:
php artisan migrate
On a fresh server you can run php artisan migrate --force to bypass the production environment prompt.

Seeding Roles and Modules

Cole’s authorization system depends on a fixed set of roles (managed by Spatie Laravel Permission) and a catalogue of optional feature modules. Both must be seeded before any users can be created.
php artisan db:seed --class=RoleSeeder
php artisan db:seed --class=ModuleSeeder
Or run the full DatabaseSeeder, which calls both in the correct order:
php artisan db:seed
Roles created by RoleSeeder:
RoleDescription
super-adminManages tenants (schools) across the entire platform
directorManages a single school: periods, courses, teachers, students
profesorRecords grades, attendance, and agenda items for assigned classes
estudianteStudents enrolled in courses
padreParents/guardians who monitor their children’s activity
Modules created by ModuleSeeder:
CodeName
agendaAcademic Agenda (tasks and assignments)
asistenciaAttendance
circularesSchool Circulars
anecdotarioAnecdotal Records
bibliotecaLibrary
estudiantesStudents
Modules are activated per-tenant by a super-admin via PATCH /api/tenants/{tenantId}/modules/{moduleId}/activate. A tenant only has access to the features whose modules are active.

When FILESYSTEM_DISK=public, Laravel serves uploaded files through the public/storage directory. Create the symlink with:
php artisan storage:link
This links public/storagestorage/app/public. After this, uploaded tenant logos and agenda file attachments are reachable at https://api.yourschool.com/storage/{path}.

CORS Configuration

Cole’s CORS policy lives in config/cors.php. The default configuration allows all origins, methods, and headers — suitable for development:
'paths' => ['api/*', 'sanctum/csrf-cookie', 'storage/*'],
'allowed_methods' => ['*'],
'allowed_origins' => ['*'],
'allowed_headers' => ['*'],
'supports_credentials' => false,
For production, replace 'allowed_origins' => ['*'] with the specific domains of your frontend application(s). Leaving it open allows any website to make authenticated requests to your API.

Creating the First Super-Admin

The super-admin role is responsible for provisioning new school tenants. Create the first super-admin account by registering through the API and then assigning the role directly in the database (or via Tinker), since no director exists yet to delegate that action. Register a user:
curl -X POST https://api.yourschool.com/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Platform Admin",
    "email": "admin@yourplatform.com",
    "password": "supersecret",
    "password_confirmation": "supersecret"
  }'
Assign the super-admin role via Tinker:
php artisan tinker
$user = \App\Models\User::where('email', 'admin@yourplatform.com')->firstOrFail();
$user->assignRole('super-admin');
Login to obtain a Bearer token:
curl -X POST https://api.yourschool.com/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "admin@yourplatform.com",
    "password": "supersecret"
  }'
{
  "token": "1|abc123...",
  "user": {
    "id": 1,
    "name": "Platform Admin",
    "email": "admin@yourplatform.com"
  }
}
Pass this token as Authorization: Bearer <token> on all subsequent requests.

Creating a Tenant (School)

With the super-admin token, provision a new school tenant:
curl -X POST https://api.yourschool.com/api/tenants \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Lincoln High School",
    "domain": "lincoln",
    "email": "director@lincoln.edu"
  }'
The super-admin can then activate modules for that tenant:
curl -X PATCH https://api.yourschool.com/api/tenants/1/modules/2/activate \
  -H "Authorization: Bearer <token>"
Once the tenant is set up, a director user can be created for that school and the academic structure can be built. Continue to the Academic Structure guide.

Build docs developers (and LLMs) love