Skip to content

Instantly share code, notes, and snippets.

@mcloots
Last active October 20, 2020 14:32
Show Gist options
  • Save mcloots/3c7efe6804f6aa600428bbb98cecec5b to your computer and use it in GitHub Desktop.
Save mcloots/3c7efe6804f6aa600428bbb98cecec5b to your computer and use it in GitHub Desktop.
Data inserts student administration project
DB::table('courses')->insert(
[
[
'programme_id' => 1,
'name' => 'PHP',
'description' => 'Develop web applications in PHP using Laravel',
'created_at' => now()
],
[
'programme_id' => 1,
'name' => 'Webdesign Essentials',
'description' => 'Learn the basics of web development',
'created_at' => now()
],
[
'programme_id' => 1,
'name' => 'IoT Essentials',
'description' => 'Internet of Things is awesome!',
'created_at' => now()
],
[
'programme_id' => 2,
'name' => 'Communication',
'description' => 'Learn to communicate with other people',
'created_at' => now()
],
[
'programme_id' => 2,
'name' => 'Intercultural Relations Management',
'description' => 'Be ready to conquer the world',
'created_at' => now()
],
[
'programme_id' => 5,
'name' => 'Anatomy',
'description' => 'Study the structure of organisms and their parts',
'created_at' => now()
],
[
'programme_id' => 5,
'name' => 'How To Communicate As A Caregiver?',
'description' => 'Communication strategies between caregiver and patient',
'created_at' => now()
],
]
);
// Insert some data
DB::table('programmes')->insert(
[
[
'name' => 'IT Factory'
],
[
'name' => 'Office Management'
],
[
'name' => 'Business and Tourism'
],
[
'name' => 'Media and Communication'
],
[
'name' => 'People & Health'
]
]
);
DB::table('student_courses')->insert(
[
[
'course_id' => 1,
'student_id' => 1,
'semester' => 1
],
[
'course_id' => 1,
'student_id' => 2,
'semester' => 1
],
[
'course_id' => 4,
'student_id' => 3,
'semester' => 2
]
]
);
DB::table('students')->insert(
[
[
'programme_id' => 1,
'student_number' => 1,
'first_name' => 'Rik',
'last_name' => 'Rikken'
],
[
'programme_id' => 1,
'student_number' => 2,
'first_name' => 'Jos',
'last_name' => 'Jossen'
],
[
'programme_id' => 2,
'student_number' => 1,
'first_name' => 'Gert',
'last_name' => 'Gerten'
]
]
);
DB::table('users')->insert(
[
[
'name' => 'Michaël Cloots',
'email' => 'michael.cloots@gmail.com',
'admin' => true,
'password' => Hash::make('admin1234'),
'created_at' => now(),
'email_verified_at' => now()
]
]
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment