The Super Admin is a central user — they live in the central database, not inside any clinic’s tenant database. They are responsible for the full lifecycle of every clinic registered on the platform: onboarding new clinics, adjusting subscription limits, suspending inactive tenants, and provisioning initial staff accounts. All Super Admin functionality is available at theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Arthurr23/XHealtXperience/llms.txt
Use this file to discover all available pages before exploring further.
/panel-global path prefix and is protected by authentication, mandatory two-factor verification, and the Super Admin Spatie role.
Authentication and access
The Super Admin panel requires:- Central authentication — the Super Admin logs in through the standard Laravel auth flow, which resolves against the central
userstable. - Two-factor authentication (2FA) — the
two_factormiddleware enforces a verified 2FA challenge before anypanel-globalroute is accessible. Attempting to access the dashboard before completing 2FA redirects to/two-factor/challenge. - Role gate — the
role:Super Adminmiddleware (Spatie Permission) ensures no clinic staff member can reach the central panel even if they somehow authenticate centrally.
Route reference
Dashboard
Dashboards/SuperAdminDashboard) with three data sets:
clinicas— all registered tenants with their core metadata.administradores— empty array on initial load; populated by the administrators route.metricas— aggregate counts:total_clinicas,clinicas_activas,clinicas_suspendidas.
Create a clinic
Toggle clinic status
estado between activa and suspendida. No request body required — the controller reads the current value and flips it.
Update plan and account limit
| Field | Rules |
|---|---|
plan | required · one of basico, pro, premium, personalizado |
limite_cuentas | required · integer · 1–1000 |
Edit clinic (read)
id, nombre_clinica, email_contacto, telefono_contacto, plan, limite_cuentas, estado, fecha_inicio_suscripcion. Used by the frontend modal to pre-populate the edit form.
Update clinic
| Field | Rules |
|---|---|
nombre_clinica | required · string · max 150 |
email_contacto | required · email · max 150 |
telefono_contacto | nullable · string · max 20 |
plan | required · one of basico, pro, premium, personalizado |
limite_cuentas | required · integer · 1–1000 |
fecha_inicio_suscripcion | required · date |
Delete clinic
routes/web.php and is protected by the same auth, two_factor, and role:Super Admin middleware stack as all other panel-global routes.
List clinic administrators
SuperAdminDashboard view with tab_inicial set to administradores. Each record includes tenant_id, nombre_clinica, estado_clinica, and the user’s Spatie role names.
This route initializes tenancy for each clinic in a loop and calls
tenancy()->end() in a finally block after each iteration. Clinics whose databases are unavailable are skipped with a warning log entry — they do not abort the entire listing.Show create-user form
SuperAdmin/CrearUsuarioClinica form pre-loaded with the clinic’s name and the list of available Spatie roles seeded in that tenant’s database. If the clinic has no roles yet (edge case for clinics created before the RoleSeeder fix), this route runs tenants:migrate and tenants:seed inline as a recovery mechanism.
Save new clinic user
activation=1 parameter). Roles are assigned using Spatie’s assignRole().
| Field | Rules |
|---|---|
name | required · string · max 255 |
email | required · email · max 255 · unique within the tenant |
role | required · string · must be an existing Spatie role in the tenant DB |
Create clinic flow
Submit the registration form
The Super Admin fills in the clinic’s details on the dashboard and submits
POST /panel-global/clinicas. Laravel validates the request against the rules in SuperAdminController::store().Validate the tenant ID
The
id field is validated as alpha_dash, unique against the tenants table, and not in the reserved list. The value is lowercased before storage.Create the Tenant record
Tenant::create() writes a new row to the central tenants table with estado set to activa. A corresponding row is created in the domains table linking the domain slug to the new tenant.Provision the tenant database
Artisan::call('tenants:migrate', ['--tenants' => [$tenant->id]]) creates the clinic’s dedicated database file and runs all migrations from database/migrations/tenant/.Seed roles
Artisan::call('tenants:seed', ['--tenants' => [$tenant->id], '--class' => 'Database\\Seeders\\RoleSeeder']) seeds the standard Spatie roles (Doctor, Recepcion, Administrador Clinica, Auditor, etc.) into the new tenant’s database.Create clinic request body
Unique tenant identifier. Used as the URL path prefix for all clinic routes (e.g.
clinica-norte → /{tenantId}/dashboard).- Format:
alpha_dash(letters, numbers, hyphens, underscores) - Max length: 50 characters
- Must be unique across all tenants
- Cannot be any of the reserved IDs:
panel-global,login,logout,register,api
Full display name of the clinic, shown throughout the application UI.
- Max length: 150 characters
Primary contact / billing email address for this clinic.
- Must be a valid email address
- Max length: 150 characters
Optional contact phone number.
- Max length: 20 characters
Subscription plan that determines the default account limit. One of:
basico— default limit: 5 accountspro— default limit: 20 accountspremium— default limit: 50 accountspersonalizado— starting limit: 5 (operator configures manually)
Maximum number of staff user accounts the clinic may create. Pre-filled by the frontend based on the selected plan, but always editable.
- Minimum: 1
- Maximum: 200 (at creation; updatable to 1000 via
PATCH /limite)
Subscription start date in
YYYY-MM-DD format. Used for billing and reporting purposes.