Overview
The Terminals API allows you to manage radio terminal types and models used in the system. You can create, read, update, and delete terminal type records including their brand, model, usage type, and optional images.List Terminals
Retrieve a paginated list of terminal types.Response
Returns a paginated list of terminals (20 per page).Unique identifier for the terminal type
Foreign key reference to the usage type (TipoUso)
Brand/manufacturer of the terminal
Model name or number of the terminal
Additional notes or observations about the terminal type
File path to the terminal image (stored in images/uploads/)
Associated usage type object with its details
Example Request
Create Terminal Type
Create a new terminal type with optional image upload.Required Permissions
crear-terminal
Request Body
Usage type for the terminal. Must match an existing uso value in the tipo_uso table (cannot be “Selecciona su uso”).
Brand or manufacturer name of the terminal
Model name or number
Additional notes or observations about this terminal type
Image file for the terminal. If provided, the file will be uploaded to
images/uploads/ with a timestamp prefix.Example Request
Response
On success, redirects to/terminales (index page).
Error Responses
“ERROR” if the operation fails
Detailed error message from the exception
All create and update operations are wrapped in database transactions. If any error occurs, the transaction is rolled back to maintain data integrity.
Create Form
Retrieve the form for creating a new terminal type.Required Permissions
crear-terminal
Response
Returns a view with available usage types (tipo_uso) for the dropdown.Edit Terminal Type
Retrieve terminal type details for editing.Required Permissions
editar-terminal
Path Parameters
The ID of the terminal type to edit
Response
Returns a view with the terminal data and available usage types.Update Terminal Type
Update an existing terminal type.Required Permissions
editar-terminal
Path Parameters
The ID of the terminal type to update
Request Body
Usage type for the terminal (must exist in tipo_uso table)
Brand or manufacturer name
Model name or number
Additional notes
New image file. If not provided, the existing image is preserved.
Example Request
Response
On success, redirects to/terminales (index page).
When updating, if no new image is provided, the system preserves the existing image path. Only upload a new image if you want to replace the current one.
Delete Terminal Type
Delete a terminal type from the system.Required Permissions
borrar-terminal
Path Parameters
The ID of the terminal type to delete
Response
On success, redirects to/terminales (index page).
Be careful when deleting terminal types that are referenced by equipment records. This may cause foreign key constraint violations.
Validation Rules
When creating or updating terminal types, the following validation rules apply:- tipo_uso: Required, cannot be “Selecciona su uso”
- marca: Required string field
- modelo: Required string field
- observaciones: Optional text field
- imagen: Optional file upload
Image Upload
The image upload functionality has the following characteristics:- Images are stored in the
images/uploads/directory - Uploaded files are prefixed with a Unix timestamp to ensure uniqueness
- Format:
{timestamp}-{original-filename} - Example:
1710435200-motorola-dgp8550e.jpg - Only uploaded when a file is present in the request
Image Storage Example
Error Codes
Validation failed. Common errors include:
- Missing required fields (marca, modelo, tipo_uso)
- Invalid tipo_uso selection
You don’t have the required permission to perform this action.
Database transaction failed or file upload error. Returns JSON with error details:
Relationships
Terminal types have the following relationships:- tipo_uso (belongs to): Associated usage type that categorizes the terminal
- equipos (has many): Equipment records that use this terminal type
Controller Source
You can find the implementation in:- Controller:
app/Http/Controllers/TipoTerminalController.php - Model:
app/Models/TipoTerminal.php - Table:
tipo_terminales