/** * Lists all CodeMember models. * @return mixed */ public function actionIndex() { $searchModel = new CodeMemberSearch(); $searchModel->codeBank_code = Yii::$app->request->get('code'); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }
public function actionCreateInvitation() { $request = Yii::$app->request; $user_id = $request->get('user_id'); $codeMember = new CodeMemberForm(); if ($request->isPost && $codeMember->load($request->post())) { if ($codeMember->validate()) { $codeMember->saveToMessage(); Yii::$app->session->setFlash('success', 'Your invitation has been sent to ' . $codeMember->email); return $this->redirect(['index', 'user_id' => $user_id]); } } $searchModel = new CodeMemberSearch(); $searchModel->user_id = $user_id; $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'form' => $this->renderPartial('_form_member', ['model' => $codeMember, 'roleOptions' => $this->roleOptions])]); //check if the email exist //check if post //save to message set type=1 means invitation }