public function actionCreateTable($id) { $model = $this->findModel($id); if ($model->load(Yii::$app->request->post()) && $model->save()) { try { Table::createTable($model->id); } catch (Exception $e) { Yii::$app->getSession()->setFlash('error', $e->getMessage()); return $this->redirect(['update', 'id' => $model->id]); } } return $this->render('createTable', ['model' => $model]); }