/** * Creates a new ApplicationBaseInfo model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $this->layout = 'index'; $model = new ApplicationBaseInfo(); if ($model->load(Yii::$app->request->post()) && $model->addApplication()) { $request = Yii::$app->getRequest(); $authManager = Yii::$app->getAuthManager(); $connection = Yii::$app->getDb(); $sql = "INSERT INTO " . $authManager->itemTable . " SET name=:name,type=:type,description=:desc,"; $sql .= "updated_at=:upat,created_at=:crat"; $time = time(); $params = [':name' => strval($model->app_key), ':type' => intval(1), ':desc' => strval($model->app_name), ':upat' => $time, ':crat' => $time]; $command = $connection->createCommand($sql, $params); $result = $command->execute(); if ($result) { return $this->redirect(['view', 'id' => $model->id]); } else { exit('Add Item failed!!!'); die; } } else { return $this->render('create', ['model' => $model]); } }