If you have a large amount of data in an existing database, that you want to convert into seed data, it might be easiest to simply use raw insert
statements in your migration’s seed
method:
Capsule::connection()->insert("
INSERT INTO `courses` (`id`, `institution_id`, `course_num`, `title`, `subject`, `flag_visible`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 3, 'MATH003', 'Developmental Mathematics', 'Algebra', 1, '2016-01-01 05:00:00', '2016-01-01 05:00:00', NULL),
(2, 3, 'MATH010', 'Algebra for MATH110', 'Algebra', 1, '2016-01-01 05:00:00', '2016-01-01 05:00:00', NULL),
(3, 3, 'MATH011', 'Algebra for MATH111', 'Algebra', 1, '2016-01-01 05:00:00', '2016-01-01 05:00:00', NULL),
(4, 3, 'MATH013', 'Algebra for MATH113', 'Algebra', 1, '2016-01-01 05:00:00', '2016-01-01 05:00:00', NULL),
(5, 3, 'MATH015', 'Algebra for MATH115', 'Algebra', 1, '2016-01-01 05:00:00', '2016-01-01 05:00:00', NULL),
(6, 3, 'MATH110', 'Elementary Mathematical Models', 'Algebra', 1, '2016-01-01 05:00:00', '2016-01-01 05:00:00', NULL),
(7, 3, 'MATH111', 'Introduction to Probability', 'Probability/Statistics', 1, '2016-01-01 05:00:00', '2016-01-01 05:00:00', NULL),
(8, 3, 'MATH112', 'College Algebra with Applications and Trigonometry', 'Trigonometry', 1, '2016-01-01 05:00:00', '2016-01-01 05:00:00', NULL)
");
The tricky part is if you have foreign keys in this data - you will need to make sure that they match up correctly with any data you have in other migrations.