Explorar el Código

feat(support): adiciona validacao de suporte

ebagabee hace 3 semanas
padre
commit
8484c56ffb
Se han modificado 1 ficheros con 4 adiciones y 3 borrados
  1. 4 3
      app/Http/Controllers/SupportTicketController.php

+ 4 - 3
app/Http/Controllers/SupportTicketController.php

@@ -20,9 +20,10 @@ public function index(): JsonResponse
             ->with(['applicantUnit', 'targetUnit'])
             ->orderBy('created_at', 'desc');
 
-        if (!$this->isMatriz($user)) {
-            $unitId = $user->units()->first()?->id;
-            $query->visibleToUnit($unitId);
+        if ($this->isMatriz($user)) {
+            $query->where(fn($q) => $q->where('origin', '!=', 'unit')->orWhere('scope', '!=', 'internal'));
+        } else {
+            $query->visibleToUnit($user->units()->first()?->id);
         }
 
         return $this->successResponse(