83 lines
3.7 KiB
PHP
83 lines
3.7 KiB
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use Illuminate\Database\Seeder;
|
|
use App\Models\IvOrganised;
|
|
use Carbon\Carbon;
|
|
|
|
class IvOrganisedTableSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function run()
|
|
{
|
|
// Example data for random selection
|
|
$companyNames = ['Google', 'Microsoft', 'Amazon', 'IBM', 'Infosys', 'TCS', 'Wipro', 'Facebook', 'Tesla'];
|
|
$companyAddresses = [
|
|
'Bangalore Electronic City, Karnataka',
|
|
'Hyderabad Hitech City, Telangana',
|
|
'Pune IT Park, Maharashtra',
|
|
'Mumbai Bandra Kurla Complex, Maharashtra',
|
|
'NCR Noida, Uttar Pradesh'
|
|
];
|
|
$resourcePersons = ['Mr. Raj Kumar', 'Ms. Priya Singh', 'Dr. Anil Sharma', 'Er. Neha Patel', 'Mr. Vikram Mehta'];
|
|
$contactDetails = [
|
|
'raj.kumar@example.com | +91 9876543210',
|
|
'priya.singh@example.com | +91 8765432109',
|
|
'anil.sharma@example.com | +91 7654321098',
|
|
'neha.patel@example.com | +91 6543210987',
|
|
'vikram.mehta@example.com | +91 5432109876'
|
|
];
|
|
$targetAudiences = ['Faculty', 'Students'];
|
|
$studentYears = ['First Year', 'Second Year', 'Third Year', 'Final Year'];
|
|
$objectives = [
|
|
'To expose students to real-world industrial environments',
|
|
'To bridge the gap between theoretical and practical knowledge',
|
|
'To understand industrial processes and practices',
|
|
'To provide insights into current industry trends',
|
|
'To explore potential career opportunities and requirements'
|
|
];
|
|
$outcomes = [
|
|
'Students gained practical exposure to industrial processes',
|
|
'Enhanced understanding of theoretical concepts through practical demonstrations',
|
|
'Participants became aware of industry expectations and requirements',
|
|
'Improved industry-academia interaction',
|
|
'Students received guidance on career opportunities and skill requirements'
|
|
];
|
|
|
|
// 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, 2))->addHours(rand(0, 23))->addMinutes(rand(0, 59));
|
|
|
|
// Determine if target audience is students or faculty
|
|
$targetAudience = $targetAudiences[array_rand($targetAudiences)];
|
|
$studentYear = $targetAudience === 'Students' ? $studentYears[array_rand($studentYears)] : null;
|
|
|
|
// Create the record
|
|
IvOrganised::create([
|
|
'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'),
|
|
'company_name' => $companyNames[array_rand($companyNames)],
|
|
'company_address' => $companyAddresses[array_rand($companyAddresses)],
|
|
'resource_person_name' => $resourcePersons[array_rand($resourcePersons)],
|
|
'resource_person_contact_details' => $contactDetails[array_rand($contactDetails)],
|
|
'target_audience' => $targetAudience,
|
|
'student_year' => $studentYear,
|
|
'number_of_participants' => rand(20, 100),
|
|
'objective' => $objectives[array_rand($objectives)],
|
|
'outcomes' => $outcomes[array_rand($outcomes)],
|
|
'department_id' => rand(1, 5),
|
|
'proof' => null, // Null for proof
|
|
]);
|
|
}
|
|
}
|
|
} |