public function actionAddnewcourse() { $model = new Course(); if ($model->load(\Yii::$app->getRequest()->getBodyParams(), '')) { $result = \Yii::$app->getRequest()->getBodyParams(); $model->course_code = "UNKNOWN"; $model->course_name = $result; $model->course_status = 0; if ($model->save()) { return $model->course_id; } } }
/** * @return \yii\db\ActiveQuery */ public function getCourse() { return $this->hasOne(Course::className(), ['course_id' => 'course_id']); }
public function actionPopulateeducationinputs() { $result = array(); $result['institutions'] = Institution::find()->all(); $result['education_levels'] = EducationLevel::find()->all(); $result['courses'] = Course::findUniCourse(); $result['universities'] = University::find()->all(); return $result; }