Ejemplo n.º 1
0
 /**
  * Creates a new Status model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Status();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Ejemplo n.º 2
0
 public function actionCreate()
 {
     $model = new Status();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         // valid data received in $model
         return $this->render('view', ['model' => $model]);
     } else {
         // either the page is initially displayed or there is some validation error
         return $this->render('create', ['model' => $model]);
     }
 }
Ejemplo n.º 3
0
 /**
  * Creates a new Status model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Status();
     if ($model->load(Yii::$app->request->post())) {
         /* $model->created_by = Yii::$app->user->getId();
            $model->created_at = time();
            $model->updated_at = time();*/
         if ($model->save()) {
             return $this->redirect(['view', 'id' => $model->id]);
         }
     }
     return $this->render('create', ['model' => $model]);
 }
Ejemplo n.º 4
0
 /**
  * Creates a new Status model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Status();
     if ($model->load(Yii::$app->request->post())) {
         //          $model->created_at = time(); <- to dela zdaj timestamp behavior
         //          $model->updated_at = time();
         //		  $model->created_by = Yii::$app->user->getId(); <- to dela zdaj bleameble behavior
         if ($model->save()) {
             //             return $this->redirect(['view', 'id' => $model->id]);
             return $this->redirect(['index']);
         }
     }
     return $this->render('create', ['model' => $model]);
 }