コード例 #1
0
ファイル: TeacherController.php プロジェクト: AtaBashir/ams
 /**
  * Creates a new Teacher model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Teacher();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->tchr_id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
コード例 #2
0
 public function actionCreate()
 {
     $model = new Teacher();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->save()) {
             return $this->redirect(Url::to(['/teacher/view', 'id' => $model->id]));
         }
     }
     return $this->render('create', ['model' => $model]);
 }
コード例 #3
0
 /**
  * Updates Teacher into database
  *
  * @param Teacher $teacher
  * @param array $input
  *
  * @return Teacher
  */
 public function update($teacher, $input)
 {
     $teacher->fill($input);
     $teacher->save();
     return $teacher;
 }