Ejemplo n.º 1
0
 /**
  * Updates an existing PokerEvent model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     $task = Yii::$app->request->post('task', 'save');
     $dataProviderPlayersStat = PokerEventPlayerStat::searchPlayersStatInEvent($model->id);
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         $model->save();
         if ($task == 'apply') {
             return $this->redirect(['update', 'id' => $model->id]);
         } else {
             return $this->redirect(['index']);
         }
     } else {
         return $this->render('update', ['model' => $model, 'dataProviderPlayersStat' => $dataProviderPlayersStat]);
     }
 }