/** * Creates a new UsersRequest model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new UsersRequest(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'request_id' => $model->request_id, 'user_id' => $model->user_id]); } else { return $this->render('create', ['model' => $model]); } }
/** * Assign a responsible for the request. * For ajax request will return json object * and for non-ajax request if deletion is successful, the browser will be redirected to the 'index' page. * @param string $id * @return mixed * @throws NotFoundHttpException */ public function actionAsign() { $request = Yii::$app->request; $model = new UsersRequest(); $model->user_id = $request->post()['Request']['user_id']; $model->request_id = $request->post()['Request']['request_id']; $model->save(); return $this->redirect('advanced?id=' . $model->request_id); }