/** Add My Booth */ public function actionBoothschedule() { if (Yii::$app->request->post()) { $boothschedule = new BoothSchedules(); $value = \Yii::$app->request->post(); if (isset($value['booth_id']) && isset($value['attendee_id'])) { $userid = User::findOne(['id' => $value['attendee_id']]); if ($userid) { $contact = AmgenContactList::findOne($userid->attendee_id); $checkboothexits = $boothschedule->findOne(['booth_id' => $value['booth_id'], 'attendee_id' => $userid->attendee_id]); if ($checkboothexits) { echo "Booth is already added for this attendee"; } else { $boothschedule->booth_id = $value['booth_id']; $boothschedule->attendee_id = $userid->attendee_id; $boothschedule->function_id = $contact->function_Id; $boothschedule->cost_center_id = ""; $boothschedule->status_id = 1; if ($boothschedule->save(FALSE)) { echo "Booth Schedule is Added"; } } } else { echo "Contact List not exist"; } } else { echo "Please fill required "; } } }
/** * Finds the AmgenContactList model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return AmgenContactList the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = AmgenContactList::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }