whereNotNull('excluded_at') ->whereYear('excluded_at', $now->year) ->whereMonth('excluded_at', $now->month) ->orderBy('excluded_at', 'desc'); if ($this->search) { $term = '%' . mb_strtolower($this->search) . '%'; $query->where(function ($q) use ($term) { $q->whereRaw('UNACCENT(LOWER(name)) LIKE UNACCENT(?)', [$term]) ->orWhereRaw('UNACCENT(LOWER(cpf)) LIKE UNACCENT(?)', [$term]) ->orWhereRaw("TO_CHAR(excluded_at, 'DD/MM/YYYY') LIKE ?", [$term]); }); } return $query->get()->map(fn($u) => [ $u->name, $u->cpf ?? '', $u->excluded_at?->format('d/m/Y') ?? '', ]); } public function headings(): array { return ['Nome', 'CPF', 'Data de Exclusão']; } public function title(): string { return 'Exclusões do Mês'; } public function columnWidths(): array { return ['A' => 40, 'B' => 20, 'C' => 20]; } public function styles(Worksheet $sheet): array { return [ 1 => [ 'font' => ['bold' => true, 'color' => ['argb' => 'FFFFFFFF']], 'fill' => ['fillType' => Fill::FILL_SOLID, 'startColor' => ['argb' => 'FF661D75']], 'alignment' => ['horizontal' => Alignment::HORIZONTAL_CENTER], ], ]; } }