public function actionAddEvent() { $data = $_POST; $model = new Event(); $model->u_id = $data['uid']; $model->lat = $data['lat']; $model->lng = $data['lng']; $model->address = $data['address']; $model->message = $data['message']; $model->status = 0; if ($model->save()) { $e_id = $model->primaryKey; $model = new EventMedia(); foreach (explode(",", $data['files'], -1) as $id) { $model->updateByPk($id, array("e_id" => $e_id)); } $tids = explode(",", $data['tid']); foreach ($tids as $tid) { $model = new EventType(); $model->event = $e_id; $model->node = $tid; $model->save(); } echo 1; } else { echo 0; } }
public function postIndex() { $event_id = Input::get('event_id'); $latlng = Input::get('search_location_hidden'); $food_type = Input::get("search_food"); $param = ""; if (!empty($_POST['check_list'])) { // Loop to store and display values of individual checked checkbox. foreach ($_POST['check_list'] as $selected) { //echo $selected."</br>"; if ($param != "") { $param = $param . "," . $selected; } else { $param = $selected; } } } $typeFood = new EventType(); $typeFood->event_id = $event_id; $typeFood->user_id = Auth::user()->id; $typeFood->latlng = $latlng; $typeFood->type = $food_type; $typeFood->parameters = $param; $typeFood->save(); $userdata = ActiveEvent::whereRaw("event_id = ? and user_id = ?", array($event_id, Auth::user()->id))->first(); $userdata->is_submitted = "true"; $userdata->save(); return Redirect::to('/result?event_id=' . $event_id); }