Menu

## PromotionImport
in package
implements ToCollection, WithHeadingRow uses RegisterUser

PromotionImport.php : 31

Class PromotionImport

Handles student promotion processing via Excel import. Based on exam results, students are either promoted to the next academic year/standard or marked as alumni.

Uses database transactions to ensure data integrity.

### Table of Contents

#### Interfaces

ToCollection
WithHeadingRow

#### Methods

AddAlumni() : User
  Create or fetch an alumni user and seed profile data.
collection() : void
  Process imported promotion records.
CreateAlumni() : mixed
  Create an alumni profile record for an existing user.
CreateMark() : Mark|Mark
  Create or update a mark entry for a student exam.
CreateParent() : User
  Create a parent user and link to a student.
CreateTeacher() : User
  Create a teacher user with profile and teacher-specific attributes.
CreateUser() : User
  Create a new student user with profile and academic details.
UpdateParent() : Userprofile
  Update parent profile details and qualifications.
UpdateUser() : Userprofile
  Update an existing student user profile and academic record.

### Methods

#### AddAlumni()

RegisterUser.php : 822

Create or fetch an alumni user and seed profile data.

`public AddAlumni(object $data, int $usergroup_id, int $school_id, string $passing_session) : User`

##### Parameters

$data : object

  Request payload with alumni details

$usergroup_id : int

  Alumni role id

$school_id : int

  School identifier

$passing_session : string

  Passing year/batch

##### Return values

User —

Alumni user model

#### collection()

PromotionImport.php : 49

Process imported promotion records.

`public collection(Collection $rows) : void`

For each student row:

- Updates academic status (pass/fail)
- Creates promotion records for passed students
- Creates next academic year StudentAcademic records
- Handles alumni conversion when applicable

All operations are wrapped in a database transaction.

##### Parameters

$rows : Collection

#### CreateAlumni()

RegisterUser.php : 900

Create an alumni profile record for an existing user.

`public CreateAlumni(object $data, string $path, int $usergroup_id, int $school_id, User $user) : mixed`

##### Parameters

$data : object

  Alumni profile payload

$path : string

  Photo path

$usergroup_id : int

  Alumni role id

$school_id : int

  School identifier

$user : User

  User to link

##### Return values

mixed —

Persisted alumni profile

#### CreateMark()

RegisterUser.php : 750

Create or update a mark entry for a student exam.

`public CreateMark(object $data, int $school_id, AcademicYear $academic_year, int $sc_grade, int|null $non_sc_grade) : Mark|Mark`

##### Parameters

$data : object

  Payload with mark details and associations

$school_id : int

  School identifier

$academic_year : AcademicYear

  Academic year model

$sc_grade : int

  Scholastic grading scheme id

$non_sc_grade : int|null

  Non-scholastic grading scheme id

##### Return values

Mark|Mark —

Persisted mark model

#### CreateParent()

RegisterUser.php : 357

Create a parent user and link to a student.

`public CreateParent(int|null $student_id, object $data, int $school_id, int $usergroup_id) : User`

##### Parameters

$student_id : int|null

  Student identifier to attach (optional)

$data : object

  Request payload containing parent details

$school_id : int

  School identifier

$usergroup_id : int

  Parent role id

##### Return values

User —

Parent user model

#### CreateTeacher()

RegisterUser.php : 567

Create a teacher user with profile and teacher-specific attributes.

`public CreateTeacher(object $data, int $school_id, AcademicYear $academic_year, string $path, int $usergroup_id) : User`

##### Parameters

$data : object

  Request payload with teacher info

$school_id : int

  School identifier

$academic_year : AcademicYear

  Academic year model

$path : string

  Avatar path if provided

$usergroup_id : int

  Teacher role id

##### Return values

User —

Newly created teacher

#### CreateUser()

RegisterUser.php : 40

Create a new student user with profile and academic details.

`public CreateUser(object $data, int $school_id, int $academic_year_id, string $path, int $usergroup_id) : User`

##### Parameters

$data : object

  Request payload containing user, profile, and academic info

$school_id : int

  School identifier

$academic_year_id : int

  Academic year identifier

$path : string

  Avatar path if available

$usergroup_id : int

  User group id for the student

##### Return values

User —

Newly created user

#### UpdateParent()

RegisterUser.php : 482

Update parent profile details and qualifications.

`public UpdateParent(int $student_id, object $data, int $school_id, int $user_id) : Userprofile`

##### Parameters

$student_id : int

  Associated student id

$data : object

  Request payload containing parent updates

$school_id : int

  School identifier

$user_id : int

  Parent user identifier

##### Return values

Userprofile —

Updated parent profile

#### UpdateUser()

RegisterUser.php : 204

Update an existing student user profile and academic record.

`public UpdateUser(object $data, int $school_id, int $academic_year_id, int $user_id, string $path) : Userprofile`

##### Parameters

$data : object

  Request payload with updated fields

$school_id : int

  School identifier

$academic_year_id : int

  Academic year identifier

$user_id : int

  User identifier to update

$path : string

  Avatar path if replaced

##### Return values

Userprofile —

Updated profile

## Search results