From ebae87f97ce41a51d5a41a25c10834849872b556 Mon Sep 17 00:00:00 2001 From: Juan Felipe Zapata Moreno Date: Wed, 21 Jan 2026 16:29:27 -0600 Subject: [PATCH] fix: excel actualizaciones filtrar por modulo --- app/Http/Controllers/Repuve/ExcelController.php | 4 ++-- app/Models/VehicleTagLog.php | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Repuve/ExcelController.php b/app/Http/Controllers/Repuve/ExcelController.php index 1f39324..8b20567 100644 --- a/app/Http/Controllers/Repuve/ExcelController.php +++ b/app/Http/Controllers/Repuve/ExcelController.php @@ -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); }); }) diff --git a/app/Models/VehicleTagLog.php b/app/Models/VehicleTagLog.php index db321f7..9781a12 100644 --- a/app/Models/VehicleTagLog.php +++ b/app/Models/VehicleTagLog.php @@ -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');