/** * Updates an existing Stats 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); // @todo: user specific $deck_options_tmp = Deck::find()->all(); foreach ($deck_options_tmp as $deck) { $deck_options[$deck['id']] = $deck['name']; } $deck_type_options_tmp = DeckTypes::find()->all(); foreach ($deck_type_options_tmp as $deck_type) { $deck_type_options[$deck_type['id']] = $deck_type['name']; } $classes_options_tmp = Classes::find()->all(); foreach ($classes_options_tmp as $class) { $classes_options[$class['id']] = $class['name']; } if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('update', ['model' => $model, 'deck_options' => $deck_options, 'deck_type_options' => $deck_type_options, 'classes_options' => $classes_options]); } }
/** * Lists all DeckTypes models. * @return mixed */ public function actionIndex() { $dataProvider = new ActiveDataProvider(['query' => DeckTypes::find()]); return $this->render('index', ['dataProvider' => $dataProvider]); }