Loading app/Exports/ContactosExport.php +22 −17 Original line number Diff line number Diff line Loading @@ -71,14 +71,18 @@ public function headings(): array private function applyFilters($query) { if(count($this->filters['subgrupos']) > 2){ $query->orWhereHas('subgrupos', function ($q) { $q->whereIn('subgrupos.id', $this->filters['subgrupos']); }); }else{ if (!empty($this->filters['subgrupos'])) { $query->orWhereHas('subgrupos', function ($q) { $q->whereIn('subgrupos.id', $this->filters['subgrupos']); }); } elseif (!empty($this->filters['grupos'])) { $grupoId = $this->filters['grupos']; $subgruposIds = Grupos::find(153)->subgrupos->pluck('id')->toArray(); $subgruposIds = Grupos::find($grupoId)->subgrupos->pluck('id')->toArray(); $query->where(function ($query) use ($grupoId, $subgruposIds) { // Contactos directamente en el grupo Loading @@ -94,6 +98,7 @@ private function applyFilters($query) } }); } } if ($this->filters['mesInicio'] != "NaN" && $this->filters['diaInicio'] != "NaN") { $mesInicio = $this->filters['mesInicio']; Loading Loading
app/Exports/ContactosExport.php +22 −17 Original line number Diff line number Diff line Loading @@ -71,14 +71,18 @@ public function headings(): array private function applyFilters($query) { if(count($this->filters['subgrupos']) > 2){ $query->orWhereHas('subgrupos', function ($q) { $q->whereIn('subgrupos.id', $this->filters['subgrupos']); }); }else{ if (!empty($this->filters['subgrupos'])) { $query->orWhereHas('subgrupos', function ($q) { $q->whereIn('subgrupos.id', $this->filters['subgrupos']); }); } elseif (!empty($this->filters['grupos'])) { $grupoId = $this->filters['grupos']; $subgruposIds = Grupos::find(153)->subgrupos->pluck('id')->toArray(); $subgruposIds = Grupos::find($grupoId)->subgrupos->pluck('id')->toArray(); $query->where(function ($query) use ($grupoId, $subgruposIds) { // Contactos directamente en el grupo Loading @@ -94,6 +98,7 @@ private function applyFilters($query) } }); } } if ($this->filters['mesInicio'] != "NaN" && $this->filters['diaInicio'] != "NaN") { $mesInicio = $this->filters['mesInicio']; Loading