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');