$faker->name(), 'email' => "novo.associado{$i}@serprati.test", 'password' => Hash::make('senha123'), 'type' => UserTypeEnum::ASSOCIADO, 'language' => 'pt', 'status' => UserStatusEnum::ACTIVE, 'cpf' => $this->formatCpf($i), 'registration' => 'NA' . str_pad($i, 4, '0', STR_PAD_LEFT), 'phone' => $faker->cellphoneNumber(), 'admission_date' => Carbon::create(2026, 5, rand(1, 18)), 'expiry_date' => Carbon::create(2027, 5, rand(1, 18)), 'position_id' => $this->positions[($i - 1) % count($this->positions)], 'sector_id' => $this->sectors[($i - 1) % count($this->sectors)], 'created_at' => $createdAt, 'updated_at' => $createdAt, ]); } // ── Tab 3: Exclusões do mês ───────────────────────────────────────── // 25 associados inativos excluídos em maio/2026, cadastrados antes for ($i = 1; $i <= 25; $i++) { $createdAt = Carbon::create(2026, rand(1, 4), rand(1, 28), rand(8, 17), rand(0, 59)); $excludedAt = Carbon::create(2026, 5, rand(1, 18), rand(8, 17), rand(0, 59)); $offset = $i + 25; User::create([ 'name' => $faker->name(), 'email' => "excluido.associado{$i}@serprati.test", 'password' => Hash::make('senha123'), 'type' => UserTypeEnum::ASSOCIADO, 'language' => 'pt', 'status' => UserStatusEnum::INACTIVE, 'cpf' => $this->formatCpf($offset), 'registration' => 'EX' . str_pad($i, 4, '0', STR_PAD_LEFT), 'phone' => rand(0, 1) ? $faker->cellphoneNumber() : null, 'admission_date' => $createdAt->copy()->subMonths(rand(1, 6)), 'expiry_date' => null, 'position_id' => $this->positions[($i - 1) % count($this->positions)], 'sector_id' => $this->sectors[($i - 1) % count($this->sectors)], 'excluded_at' => $excludedAt, 'created_at' => $createdAt, 'updated_at' => $excludedAt, ]); } $this->command->info('AssociadosRelatorioSeeder: 25 novos associados + 25 exclusões do mês criados.'); } private function formatCpf(int $n): string { $base = str_pad($n, 9, '0', STR_PAD_LEFT); return substr($base, 0, 3) . '.' . substr($base, 3, 3) . '.' . substr($base, 6, 3) . '-00'; } }