Feat: Seeder for all tales
This commit is contained in:
73
database/seeders/ActivitiesOrganisedTableSeeder.php
Normal file
73
database/seeders/ActivitiesOrganisedTableSeeder.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Models\ActivitiesOrganised;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class ActivitiesOrganisedTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// Example data for random selection
|
||||
$titles = ['Web Development Workshop', 'AI and ML Seminar', 'IoT Bootcamp', 'Cybersecurity Conference', 'Big Data Analytics', 'Cloud Computing Masterclass'];
|
||||
$resourcePersons = ['Dr. John Smith', 'Prof. Sarah Johnson', 'Dr. Michael Wong', 'Er. David Miller', 'Dr. Emily Chen'];
|
||||
$organizations = ['Google', 'Microsoft', 'Amazon', 'IBM', 'Oracle', 'Meta', 'Apple'];
|
||||
$targetAudiences = ['Faculty', 'Students', 'Both'];
|
||||
$venues = ['Main Auditorium', 'Seminar Hall', 'Conference Room', 'Virtual Platform', 'Computer Lab'];
|
||||
$activityTypes = ['Workshop', 'Seminar', 'Conference', 'Training Program', 'Hackathon'];
|
||||
$categories = ['Technical', 'Social', 'Professional Development', 'Research', 'Industry Connect'];
|
||||
$levels = ['Department', 'College', 'State', 'National', 'International'];
|
||||
$objectives = [
|
||||
'To enhance technical skills and knowledge in the field',
|
||||
'To provide hands-on experience with industry tools',
|
||||
'To bridge the gap between academia and industry',
|
||||
'To promote research and innovation',
|
||||
'To improve problem-solving capabilities'
|
||||
];
|
||||
$outcomes = [
|
||||
'Participants gained practical knowledge and skills',
|
||||
'Created awareness about emerging technologies',
|
||||
'Enhanced industry-academia collaboration',
|
||||
'Improved research capabilities among participants',
|
||||
'Participants learned about latest industry trends'
|
||||
];
|
||||
|
||||
// Number of records to seed
|
||||
$numberOfRecords = 10;
|
||||
|
||||
for ($i = 1; $i <= $numberOfRecords; $i++) {
|
||||
// Generate random start and end dates
|
||||
$startDate = Carbon::now()->subDays(rand(1, 30))->addHours(rand(0, 23))->addMinutes(rand(0, 59));
|
||||
$endDate = (clone $startDate)->addDays(rand(0, 5))->addHours(rand(0, 23))->addMinutes(rand(0, 59));
|
||||
$numDays = $startDate->diffInDays($endDate) + 1;
|
||||
|
||||
// Create the record
|
||||
ActivitiesOrganised::create([
|
||||
'title' => $titles[array_rand($titles)],
|
||||
'resource_person_name' => $resourcePersons[array_rand($resourcePersons)],
|
||||
'resource_person_organization' => $organizations[array_rand($organizations)],
|
||||
'target_audience' => $targetAudiences[array_rand($targetAudiences)],
|
||||
'number_of_participants' => rand(20, 200),
|
||||
'objective' => $objectives[array_rand($objectives)],
|
||||
'outcomes' => $outcomes[array_rand($outcomes)],
|
||||
'department_id' => rand(1, 5),
|
||||
'faculty_id' => rand(1, 5),
|
||||
'start_date' => $startDate->format('Y-m-d H:i:s'),
|
||||
'end_date' => $endDate->format('Y-m-d H:i:s'),
|
||||
'num_days' => $numDays,
|
||||
'venue' => $venues[array_rand($venues)],
|
||||
'activity_type' => $activityTypes[array_rand($activityTypes)],
|
||||
'category' => $categories[array_rand($categories)],
|
||||
'level' => $levels[array_rand($levels)],
|
||||
'proof' => null, // Null for proof
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user