public function postIndex() { $event_name = Input::get("event_name"); $participants_string = Input::get("participants"); $participants = explode(",", $participants_string); $event = new EventCreate(); $event->name = $event_name; $event->user_id = Auth::user()->id; $event->save(); for ($i = 0; $i < count($participants); $i++) { $active_event = new ActiveEvent(); $active_event->event_id = $event->id; $active_event->user_id = (int) $participants[$i]; $active_event->is_submitted = "false"; $active_event->save(); } $active_event_current_user = new ActiveEvent(); $active_event_current_user->event_id = $event->id; $active_event_current_user->user_id = Auth::user()->id; $active_event_current_user->is_submitted = "false"; $active_event_current_user->save(); return Redirect::to('/event?event_id=' . $event->id); }