瀏覽代碼

feat(support): adiciona validacao de suporte

ebagabee 3 周之前
父節點
當前提交
8484c56ffb
共有 1 個文件被更改,包括 4 次插入3 次删除
  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'])
             ->with(['applicantUnit', 'targetUnit'])
             ->orderBy('created_at', 'desc');
             ->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(
         return $this->successResponse(