/** * Creates a new Pendingdoc model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Pendingdoc(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model]); } }
public function actionRelease($id) { //$model = $this->findModel($id); $model = new Pendingdoc(); $userid = ArrayHelper::getValue(Document::find()->where(['id' => $id])->one(), 'user_id'); $userFName = ArrayHelper::getValue(User::find()->where(['id' => $userid])->one(), 'userFName'); $userLName = ArrayHelper::getValue(User::find()->where(['id' => $userid])->one(), 'userLName'); $section = ArrayHelper::getValue(Document::find()->where(['id' => $id])->one(), 'section_id'); $documentname = ArrayHelper::getValue(Document::find()->where(['id' => $id])->one(), 'documentName'); if ($model->load(Yii::$app->request->post())) { $model->pendingDocFName = $userFName . $userLName; $model->pendingDocSection = $section; $model->pendingDocName = $documentname; if ($model->save()) { return $this->redirect(['document/index']); } } else { return $this->renderAjax('release', ['model' => $model]); } }