Listar materiales de costo unitario
GET/api/unit-cost-material
Devuelve la lista paginada de materiales. Usa BaseControllerHelper::index y agrega el filtro unit_cost_id. Los parámetros comunes (search, status, trashed, ids, fechas, per_page…) se describen en Paginación y filtros.
Parámetros de consulta
Sección titulada «Parámetros de consulta»per_pageintegerRegistros por página. Por defecto 20.
unit_cost_idintegerDevuelve solo los materiales de ese costo unitario.
orderstringCampo y sentido, por ejemplo name|ASC. Campos permitidos: id, name, created_at, updated_at, status. Por defecto id|DESC.
relationsstringRelaciones a cargar. Ver Resumen.
Permiso
Sección titulada «Permiso»No exige un permiso del módulo: UnitCostMaterialPolicy::viewAny devuelve verdadero para cualquier usuario autenticado.
curl -G \ "https://servererp.allendostmen.app/api/unit-cost-material" \ -H "Authorization: Bearer $TOKEN" \ -H "Accept: application/json" \ --data-urlencode "unit_cost_id=12" \ --data-urlencode "relations=providerProduct"const response = await fetch( "https://servererp.allendostmen.app/api/unit-cost-material?unit_cost_id=12&relations=providerProduct", { method: "GET", headers: { Authorization: `Bearer ${token}`, Accept: "application/json", }, },);const data = await response.json();use Illuminate\Support\Facades\Http;
$response = Http::withToken($token) ->acceptJson() ->get('https://servererp.allendostmen.app/api/unit-cost-material', [ 'unit_cost_id' => 12, 'relations' => 'providerProduct', ]);Lista de materiales200
{ "current_page": 1, "data": [ { "id": 31, "unit_cost_id": 12, "provider_product_id": 88, "product_id": 40, "measurement_unit_id": 5, "name": "CEMENTO PORTLAND TIPO I 42.5 KG", "description": null, "index": 1, "original_price": "25.50000000", "original_coin_id": 1, "original_coin_value": "1.00000000", "cost": 25.5, "cost_utility": 2.55, "cost_utility_percentage": 10.0, "price": 28.05, "quantity": 10.0, "total_cost": 255.0, "total_cost_utility": 25.5, "total": 280.5, "status": "activo", "previous_status": null, "status_update_comment": null, "status_update_date": null, "status_update_user_id": null, "create_user_id": 1, "update_user_id": null, "delete_user_id": null, "restore_user_id": null, "created_at": "2026-11-19T10:40:15.000000Z", "updated_at": "2026-11-19T10:40:15.000000Z", "deleted_at": null } ], "first_page_url": "https://servererp.allendostmen.app/api/unit-cost-material?page=1", "from": 1, "last_page": 1, "last_page_url": "https://servererp.allendostmen.app/api/unit-cost-material?page=1", "next_page_url": null, "path": "https://servererp.allendostmen.app/api/unit-cost-material", "per_page": 20, "prev_page_url": null, "to": 1, "total": 1}Sin permiso403
{ "message": "This action is unauthorized."}