The Credits module manages every stage of a cooperative loan — from the parametric setup of credit product lines through origination, document attachment, payment recording, and final notification. Credits (Documentation 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.
cre_creditos) are the central entity referenced by the Portfolio module’s agreements and payment vouchers, and by the Collections and Treasury modules when recording disbursements and receipts.
All credit routes are secured with the auth middleware. Credits themselves are registered directly under the top-level creditos resource (no prefix), while their sub-resources (credit lines, guarantees, documents, etc.) are managed via their own controllers within the App\Http\Controllers\Creditos namespace.
Sub-module overview
Credit Lines
Define the available loan products with terms, rates, age limits, and collateral type. Stored in
cre_lineas_creditos.Credits
Individual loan records linked to a member (
MaeTerceros), a credit line, and a lifecycle state. Stored in cre_creditos.States & Stages
Credits progress through
cre_etapas and cre_estados. Stage 16 is the default active filter in the index view.Guarantees
Collateral records attached to a credit line. Managed by
GarantiaController and stored in cre_garantias.Documents
Generic document attachments (
DocumentoController) and specialised legal instruments: escrituras (EscrituraController) and pagarés (PagareController).Notifications & Observations
NotificacionController triggers alerts on credit events. ObservacionController records operator notes traceable via User::observacionesRegistradas().Credit lines (cre_lineas_creditos)
Credit lines are the product catalogue — they define the parameters that govern every loan issued under that product. A line must exist before any credit can be originated.
cre_lineas_creditos schema
| Column | Type | Notes |
|---|---|---|
id | bigint (PK) | Auto-increment |
nombre | string | Display name of the credit line |
cuenta | integer | Accounting account code |
tasa_interes | decimal (8,2) | Annual interest rate (percentage) |
plazo_minimo | integer | Minimum term in months |
plazo_maximo | integer | Maximum term in months |
edad_minima | integer | Minimum member age |
edad_maxima | integer | Maximum member age |
monto_maximo | integer | Maximum disbursement amount |
monto_minimo | integer | Minimum disbursement amount |
seguro_todo_riesgo | integer | All-risk insurance rate or code |
fecha_apertura | date | Date the product was opened |
fecha_cierre | date (nullable) | Date the product was closed (null = still active) |
observacion | text (nullable) | Additional product notes |
cre_garantias_id | FK → cre_garantias | Required collateral type |
cre_tipos_creditos_id | FK → cre_tipos_creditos | Credit product category |
LineaCreditoController loads garantia and tipoCredito via Eager Loading on every read operation. Deleting a credit line that has existing credits associated will be blocked:
Credits (cre_creditos)
The cre_creditos table stores each individual loan record.
cre_creditos schema
| Column | Type | Notes |
|---|---|---|
id | bigint (PK) | Auto-increment |
pr | integer (unique) | Loan identifier / PR number |
pagare | integer (unique) | Promissory-note number |
valor | decimal (15,2) | Disbursed amount |
cuotas | integer | Number of instalments |
fecha_desembolso | date | Disbursement date |
cre_estados_id | FK → cre_estados | Current lifecycle state |
cre_lineas_creditos_id | FK → cre_lineas_creditos | Product line |
mae_terceros_cod_ter | bigint | FK → MaeTerceros.cod_ter (member) |
16 by default (where('cre_estados_id', 16)) and supports a nombre query parameter that searches across the related MaeTerceros.nom_ter field:
tercero, lineaCredito.tipoCredito, and estado.etapa relationships via Eager Loading.
The show view loads the full detail chain:
Originating a new credit
Ensure a credit line exists
Verify that the desired product line exists in
cre_lineas_creditos with the correct rate, term, and guarantee type. The LineaCreditoController manages these records; its routes follow the lineas_credito resource convention but are not yet registered in routes/web.php. A credit line requires at least one Garantia record and one TipoCredito record to be selectable in the credit creation form.Open the credit creation form
Go to
GET /creditos/create. The form loads three datasets:$estados— all records fromcre_estados$lineasCredito— all records fromcre_lineas_creditos$terceros— all records fromMaeTerceros
Fill in the credit details
Complete the required fields validated by
StoreCreditoRequest:pr— unique PR loan numberpagare— unique promissory-note numbervalor— disbursed amountcuotas— number of instalmentsfecha_desembolso— disbursement datecre_estados_id— initial statecre_lineas_creditos_id— product linemae_terceros_cod_ter— member’scod_ter
Attach guarantees and documents
After the credit record is created, attach the required collateral via
GarantiaController, upload legal documents via DocumentoController, and register the promissory note via PagareController or the public deed via EscrituraController. These sub-resources all reference cre_creditos_id.Record disbursement in Treasury
Once the credit is approved, register the outgoing disbursement payment in the Treasury module (see Treasury). The Treasury
tes_pagos table links back to cre_creditos_id.The
User model exposes observacionesRegistradas(): HasMany — all ObservacionController-managed notes created by a given user. Use $user->observacionesRegistradas to audit which agents have documented activity on active credits.Controller inventory
| Controller | Route (convention) | Description |
|---|---|---|
CreditoController | creditos resource | Credit CRUD |
LineaCreditoController | lineas_credito resource | Credit line CRUD |
TipoCreditoController | paramétrico | Credit type master |
EstadoController | paramétrico | Lifecycle states |
EtapaController | paramétrico | Lifecycle stages |
GarantiaController | garantias resource | Collateral records |
DocumentoController | documentos resource | Generic document attachments |
EscrituraController | escrituras resource | Public deeds |
PagareController | pagares resource | Promissory notes |
NotificacionController | notificaciones resource | Credit event notifications |
ObservacionController | observaciones resource | Operator notes |
Relationships with other modules
- Portfolio —
CarComprobantePagoandAcuerdoboth referencecre_creditos_id. - Collections —
rec_pagosstores instalment payments againstcre_creditos_id. - Treasury —
tes_pagosrecords disbursements againstcre_creditos_id.