Esempio n. 1
0
 /**
  * Creates a new Diary model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Diary();
     $query = \common\models\DiaryType::find();
     $data = $query->asArray()->all();
     $model->c_time = time();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         //            $model->getErrors();
         return $this->render('create', ['model' => $model, 'data' => $data]);
     }
 }