/**
  * Creates a new Berita model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Berita();
     if ($model->load(Yii::$app->request->post())) {
         $model->nip = \app\models\Data::nip_guru();
         $model->tgl_input = date('Y-m-d H:i:S');
         $model->isi_berita = $_POST['Berita']['isi_berita'];
         // echo '<pre>';
         // print_r($model);
         // die();
         if (!empty($model->nip)) {
             if ($model->save()) {
                 Yii::$app->session->setFlash('success', 'Simpan Berhasil');
             } else {
                 Yii::$app->session->setFlash('warning', 'Failed');
             }
         } else {
             Yii::$app->session->setFlash('warning', 'Maaf Anda Bukan Guru');
         }
     } else {
         Yii::$app->session->setFlash('danger', 'Error');
     }
     return $this->redirect(['index']);
 }