Example #1
0
 /**
  * Creates a new TblClassroom model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new TblClassroom();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         $model->user_id = Yii::$app->user->id;
         $model->start_date = date('Y-m-d h:m:s');
         $model->end_date = date('Y-m-d h:m:s');
         $model->update_date = date('Y-m-d h:m:s');
         $model->setup_time = date('Y-m-d h:m:s');
         $model->pickuptime = date('Y-m-d h:m:s');
         $model->schedule_start_time = date('Y-m-d h:m:s');
         $model->schedule_end_time = date('Y-m-d h:m:s');
         $model->status = 3;
         $model->save();
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }