fix: excel actualizaciones filtrar por modulo

This commit is contained in:
Juan Felipe Zapata Moreno 2026-01-21 16:29:27 -06:00
parent e4419f1a50
commit ebae87f97c
2 changed files with 6 additions and 2 deletions

View File

@ -45,10 +45,10 @@ public function vehicleActualizaciones(Request $request)
$module = $moduleId ? Module::find($moduleId) : null;
// Consulta de Logs de actualizaciones
$logs = VehicleTagLog::with(['vehicle', 'tag'])
$logs = VehicleTagLog::with(['vehicle', 'tag', 'performedBy.module'])
->where('action_type', 'actualizacion')
->when($moduleId, function ($query) use ($moduleId) {
$query->whereHas('vehicle.records', function ($q) use ($moduleId) {
$query->whereHas('performedBy', function ($q) use ($moduleId) {
$q->where('module_id', $moduleId);
});
})

View File

@ -41,6 +41,10 @@ public function cancelledBy() {
return $this->belongsTo(User::class, 'cancelled_by');
}
public function performedBy() {
return $this->belongsTo(User::class, 'performed_by');
}
public function cancellationReason()
{
return $this->belongsTo(CatalogCancellationReason::class, 'cancellation_reason_id');