DEXDEVS / abc-ic

ABC Learning High School
Other
0 stars 1 forks source link

Enroll multiple students in a single class #5

Closed AnasShafqat closed 5 years ago

AnasShafqat commented 5 years ago

Enroll multiple students in a single class.

Note:

GullNadia commented 5 years ago

Multiple students enrollment has done...

By Using

_form.php

<?= $form->field($model, 'std_enroll_detail_std_id')->widget(Select2::classname(), [
                    'data' => ArrayHelper::map(StdPersonalInfo::find()->all(),'std_id','std_name'),
                    'language' => 'en',
                    'options' => ['placeholder' => 'Select'],
                    'pluginOptions' => [
                        'allowClear' => true,
                        'multiple' => true
                    ],
                ]);
                ?>

StdEnrollmentDetailController.php

foreach ($array as  $value) {
                    $model = new StdEnrollmentDetail();
                    $model->std_enroll_detail_head_id = $stdEnrollmentHead->std_enroll_head_id;
                    $model->std_enroll_detail_std_id = $value;
                // select2 add multiple students end...!   
                    $model->save();
                }