public function actionDrivers($id) { $model = $this->findModel($id); $modelsDriver = new ActiveDataProvider(['query' => Drivers::find()->where(['appilcant_id' => $id])]); $model2 = new Drivers(); if ($model2->load(Yii::$app->request->post())) { $model2->appilcant_id = $id; return $this->redirect(['drivers', 'id' => $model->id]); } else { return $this->render('drivers', ['model' => $model2, 'modelsApp' => $model, 'modelsDriver' => $modelsDriver]); } }
public function actionCreateAjax() { // $model = new Drivers(); // // if ($model->load(Yii::$app->request->post())) { // // $this->CreateDir($model->ref); // //$model->covenant = $this->uploadSingleFile($model); // $model->docs = $this->uploadMultipleFile($model); // // if ($model->save()) { // return $this->redirect(['view-app', 'id' => $model->appilcant_id]); // return print_r($model); // } // } else { // $model->ref = substr(Yii::$app->getSecurity()->generateRandomString(), 10); // } // // return $this->renderAjax('create2', [ // 'model' => $model, // ]); $model = new Drivers(); if ($model->load(Yii::$app->request->post())) { $this->CreateDir($model->ref); //$model->covenant = $this->uploadSingleFile($model); $model->docs = $this->uploadMultipleFile($model); if ($model->save()) { return $this->redirect(['view-app', 'id' => $model->appilcant_id]); echo 1; } else { echo 0; } } else { $model->ref = substr(Yii::$app->getSecurity()->generateRandomString(), 10); } return $this->renderAjax('create', ['model' => $model]); }