# Phase 16: Sample Course Catalog Seeder

## Date
- 2026-04-18

## Scope
- Added an idempotent sample content seeder for instructors, categories, courses, sections, lectures, and quiz rows.
- Seed structure was adapted from the shared Current Affairs course sample reference:
  - [Nearpeer Current Affairs sample](https://nearpeer.org/css/3.-compulsory-courses/current-affairs)

## What Was Implemented
1. Sample instructor seed
   - Added `Sir Zohaib Ahmed Anjum` as a seeded instructor account:
     - `zohaib.anjum@cepi.pk`
   - Ensures:
     - `role = instructor`
     - `user_type = instructor`
2. Category hierarchy seed
   - Added:
     - `CSS`
     - `Compulsory Courses` under `CSS`
3. Sample course seed
   - Added course:
     - `Current Affairs`
   - Seeded with:
     - category mapping
     - instructor mapping
     - pricing and discount values
     - promo URL
     - published status
4. Section and lecture hierarchy
   - Seeded sections inspired by the sample structure:
     - `Demo Lecture Free`
     - `OBOR`
     - `Terrorism in Pakistan`
     - `Islamophobia`
     - `Hybrid Wars`
     - `Geo Strategies`
     - `South Asia`
     - `Pak-China US Relations`
   - Seeded lectures with mixed content types:
     - `video`
     - `article`
     - `file`
     - `quiz`
5. Quiz support
   - Quiz lectures also seed:
     - `lesson.quiz_data`
     - related rows in `quizzes`
6. Derived stats
   - After seed completion, course aggregates are refreshed:
     - `total_duration`
     - `total_lectures`
     - `total_students`
     - `rating`

## Files Added
- `database/seeders/SampleCourseCatalogSeeder.php`
- `docs/dev/16-sample-course-catalog-seeder.md`

## Files Updated
- `database/seeders/DatabaseSeeder.php`

## Seeder Notes
- The seeder is idempotent and safe to rerun.
- It uses stable keys such as:
  - category slug
  - course slug
  - instructor email
  - section title per course
  - lecture title per section

## Assumptions
- The sample page was treated as a content hierarchy reference, not a verbatim full catalog import.
- Existing LMS schema remains:
  - `courses` = main program
  - `course_modules` = sections
  - `lessons` = lectures
