|
|
@@ -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(
|