Example #1
0
 /**
  * Creates a new Nilai model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Nilai();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
 /**
  * Creates a new Nilai model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Nilai();
     if ($model->load(Yii::$app->request->post())) {
         // echo '<pre>';
         // print_r($model); die();
         if ($model->save()) {
             Yii::$app->session->setFlash('success', 'Simpan Berhasil');
         } else {
             Yii::$app->session->setFlash('warning', 'Failed');
         }
     } else {
         Yii::$app->session->setFlash('danger', 'Error');
     }
     return $this->redirect(['index']);
 }