subDays(rand(30, 365))->addHours(rand(0, 23))->addMinutes(rand(0, 59)); $endDate = (clone $startDate)->addDays(rand(1, 5))->addHours(rand(0, 23))->addMinutes(rand(0, 59)); $numDays = $startDate->diffInDays($endDate) ?: 1; // Determine if the publication is indexed $isPeer = $isPeerReviewed[array_rand($isPeerReviewed)]; $scopusLink = $isPeer === 'yes' && rand(0, 1) ? 'https://www.scopus.com/record/display.uri?eid=2-s2.0-' . rand(10000000000, 99999999999) : null; $sciLink = $isPeer === 'yes' && rand(0, 1) ? 'https://www.webofscience.com/wos/woscc/full-record/' . rand(100000, 999999) : null; // Create the publication record Publication::create([ 'department_id' => rand(1, 5), 'first_author_name' => $firstAuthorNames[array_rand($firstAuthorNames)], 'co_authors' => $coAuthors[array_rand($coAuthors)], 'start_date' => $startDate->format('Y-m-d H:i:s'), 'end_date' => $endDate->format('Y-m-d H:i:s'), 'num_days' => $numDays, 'activity_type' => $activityTypes[array_rand($activityTypes)], 'title' => $titles[array_rand($titles)], 'affiliation' => $affiliations[array_rand($affiliations)], 'organizing_institute' => $organizingInstitutes[array_rand($organizingInstitutes)], 'venue_address' => $venueAddresses[array_rand($venueAddresses)], 'is_peer_reviewed' => $isPeer, 'scopus_link' => $scopusLink, 'sci_link' => $sciLink, 'paper_file' => null, // Null for paper file 'faculty_id' => rand(1, 5), ]); } } }