The Associates module is the master registry for all cooperative members — referred to as pastors or associates — within Corpen. It maintains each member’s personal, ministerial, and document-archive record in theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/corpentunida-org/corpen/llms.txt
Use this file to discover all available pages before exploring further.
mae_asociados table, and provides a complete lifecycle from initial enrollment to ECM (Electronic Content Management) archiving. All routes are protected by the auth middleware and prefixed under /asociados.
Routes Overview
| Method | Path | Name | Description |
|---|---|---|---|
GET | /asociados/tablero | asociados.dashboard | Dashboard with KPI cards and charts |
GET | /asociados/maestro | asociados.maestro.index | Paginated associate list with search and filters |
GET | /asociados/maestro/create | asociados.maestro.create | New associate form |
POST | /asociados/maestro | asociados.maestro.store | Save new associate record |
GET | /asociados/maestro/{id} | asociados.maestro.show | View associate details |
GET | /asociados/maestro/{id}/edit | asociados.maestro.edit | Edit associate form |
PUT/PATCH | /asociados/maestro/{id} | asociados.maestro.update | Update associate record |
DELETE | /asociados/maestro/{id} | asociados.maestro.destroy | Delete associate record |
GET | /asociados/sincronizar | asociados.sincronizar.index | Excel synchronization panel |
GET | /asociados/descargar-excel | asociados.sincronizar.descargar | Download full database as .xlsx |
POST | /asociados/subir-excel | asociados.sincronizar.subir | Upload and preview Excel (Step 1) |
POST | /asociados/confirmar-sincronizacion | asociados.sincronizar.confirmar | Commit bulk upsert (Step 2) |
GET | /asociados/buscar-cedula/{cedula} | asociados.buscar-cedula | AJAX lookup by cédula in mae_asociados |
GET | /asociados/buscar-tercero/{cedula} | asociados.buscar-tercero | AJAX lookup by cédula in MaeTerceros |
GET | /asociados/ecm | asociados.ecm.index | ECM document archive view |
Dashboard
The dashboard atGET /asociados/tablero renders key performance indicators derived directly from the mae_asociados table:
- Total expedientes — full count of all associate records
- Expedientes activos — records where
estadois in['Activo', 'Vigente'] - Expedientes inactivos — records where
estadois in['Inactivo', 'Retirado', 'Suspendido'] - ECM pipeline — counters for
escaneado,cargado_ecm, andvalidado_archivo - Pendientes de radicado — records where
radicadoisnullor empty
ciudad and distrito relationships) are displayed in the Últimos Ingresos panel. Charts break down members by estado_pastor and estado_civil.
Associate Record Fields
Each record inmae_asociados captures the following groups of data:
- Identity
- Contact
- Ministry
- Documents
- ECM
| Field | Type | Notes |
|---|---|---|
cedula | string(15) | Unique national ID (primary lookup key) |
nombre1 | string(100) | First name (required) |
nombre2 | string(100) | Second name (optional) |
apellido1 | string(100) | First surname (required) |
apellido2 | string(100) | Second surname (optional) |
fecha_nacimiento | date | Date of birth |
lugar_expedicion_cedula | string(50) | Municipality of ID issuance |
fecha_expedicion | date | Date the national ID was issued |
estado_civil | string(20) | Marital status (e.g., Casado, Soltero) |
Creating and Editing Associates
Theupdate action applies the 43-field validation ruleset from getValidationRules(). The store action uses the dedicated StoreMaeAsociadoRequest form request class, which enforces the same field rules. Key constraints:
cedulamust be unique inmae_asociados(unique constraint is relaxed for the record’s ownidon update).distrito_actualmust exist inMaeDistritos.COD_DIST.ciudad_distritomust exist ingeo_ciudades.id_ciudad.- Boolean flags (
escaneado,cargado_ecm,validado_archivo) are cast from the submitted form value using$request->boolean().
sincronizar_tercero controls whether saving the associate record also synchronises the corresponding entry in MaeTerceros. When unchecked, the model property skipTerceroSync is set to true before calling save().
The
buscar-cedula/{cedula} and buscar-tercero/{cedula} AJAX endpoints are used to auto-fill the create/edit forms. When a user types a cédula, the frontend calls GET /asociados/buscar-cedula/{cedula} to check for an existing associate record, and GET /asociados/buscar-tercero/{cedula} to pre-populate fields from the master MaeTerceros directory. Both endpoints return JSON with a status field of success or error.Excel Bulk Synchronisation
The synchronisation panel (GET /asociados/sincronizar) enables administrators to upload a master .xlsx file and perform a high-volume upsert against the mae_asociados table without overloading PHP memory or hitting MySQL timeout limits.
Navigate to the synchronisation panel
Open
GET /asociados/sincronizar (asociados.sincronizar.index). The page offers two actions:- Download current database —
GET /asociados/descargar-excelgenerates a timestamped file namedmaestro_asociados_YYYY_MM_DD_His.xlsxusingAsociadosExport. - Upload a new file — use the file picker to select your
.xlsxor.xlsfile (max 50 MB).
Upload and validate the Excel file
Submit the form to
POST /asociados/subir-excel. The controller:- Validates the file with
mimes:xlsx,xls,csv|max:51200. - Reads all rows via
AsociadosImport. - Extracts every
cedulacolumn, runs a single bulk query againstmae_asociadosto identify existing records, and builds an in-memory diff. - Cleans each
cedulavalue to digits only (preg_replace('/[^0-9]/', '', ...)). - Detects duplicate cédulas within the uploaded file itself.
- Labels each row as
CREATEorUPDATE. - Caches the processed rows under key
import_asociados_{user_id}for 2 hours. - Returns a preview view (
asociados.excel-preview) showing counters for new records, updates, and any row-level warnings.
Confirm the import
Review the preview table, optionally correct individual cells inline, then submit to
POST /asociados/confirmar-sincronizacion. The controller:- Sets
set_time_limit(0)and disables the query log to prevent timeouts. - Applies any manual corrections from the form.
- Processes records in chunks of 100, calling
DB::reconnect()and wrapping each chunk in its ownDB::beginTransaction()/DB::commit()to avoid MySQL error 2006. - Uses
firstOrNew(['cedula' => ...])for upsert semantics. - On success, clears the cache key and redirects to
asociados.maestro.indexwith a success flash message. - On failure, rolls back the current chunk and redirects to the sync panel with the exact SQL error.
ECM Document Archive
The ECM view atGET /asociados/ecm (asociados.ecm.index) provides a filtered interface over the same mae_asociados table, focused on document management state. The header shows three aggregate counters:
- Digitalizados ECM — count where
cargado_ecm = true - Pendientes de archivo — count where
radicado IS NULL OR radicado = '' - Validados — count where
validado_archivo = true
| Parameter | Behaviour |
|---|---|
radicado | Exact match on the radicado field |
search | LIKE search across cedula, nombre1, and apellido1 |
estado_digitalizacion | 1 for digitised, 0 for not digitised (cargado_ecm column) |
withQueryString() so active filters survive page navigation.
Maestro de Asociados
Full CRUD at
/asociados/maestro — manage every field of a member’s personal, ministerial, and document record.Excel Sync
Bulk import or export the entire associate database via
/asociados/sincronizar using transactional chunked processing.AJAX Lookup
Auto-fill forms at
/asociados/buscar-cedula/{cedula} and /asociados/buscar-tercero/{cedula} to prevent duplicate entries.ECM Archive
Track document digitisation progress and find physical file locations at
/asociados/ecm.