Menu

## QuestionImport
in package
implements ToCollection, WithHeadingRow

QuestionImport.php : 28

Class QuestionImport

Handles importing quiz questions and options from an Excel file. Each row represents a question with up to four options.

The import process:

- Creates quiz questions
- Creates related options
- Wraps operations in a database transaction

### Table of Contents

#### Interfaces

ToCollection
WithHeadingRow

#### Properties

$chapter_id : int|string
  Chapter identifier for the imported questions.
$head_id : int|string
  Head identifier for the imported questions.

#### Methods

__construct() : mixed
  Create a new QuestionImport instance.
collection() : void
  Process the imported Excel rows.

### Properties

#### $chapter_id

QuestionImport.php : 35

Chapter identifier for the imported questions.

`public int|string $chapter_id`

#### $head_id

QuestionImport.php : 42

Head identifier for the imported questions.

`public int|string $head_id`

### Methods

#### __construct()

QuestionImport.php : 50

Create a new QuestionImport instance.

`public __construct(int|string $chapter_id, int|string $head_id) : mixed`

##### Parameters

$chapter_id : int|string

  Chapter identifier

$head_id : int|string

  Head identifier

#### collection()

QuestionImport.php : 69

Process the imported Excel rows.

`public collection(Collection $collection) : void`

For each row:

- A quiz question is created
- Related quiz options are created if present

All database operations are wrapped in a transaction to ensure data integrity.

##### Parameters

$collection : Collection

## Search results