rand(1, 5), 'department_id' => rand(1, 5), 'author' => $authors[array_rand($authors)], 'title' => $titles[array_rand($titles)], 'publisher' => $publishers[array_rand($publishers)], 'issn' => rand(0, 1) ? $this->generateISSN() : null, 'date_of_publication' => Carbon::now()->subYears(rand(0, 10))->subMonths(rand(0, 12))->subDays(rand(0, 30))->format('Y-m-d'), 'proof' => null, // No proof uploaded ]); } } private function generateISSN() { $firstPart = str_pad(rand(0, 9999), 4, '0', STR_PAD_LEFT); $secondPart = str_pad(rand(0, 999), 3, '0', STR_PAD_LEFT); $checkDigit = rand(0, 9); // Randomly replace the last digit with 'X' if (rand(0, 1)) { $checkDigit = 'X'; } return "{$firstPart}-{$secondPart}{$checkDigit}"; } }