public function AddModuleActSessionAction($user_id, $module_id, $act_id) { $activity_id = Input::get('activity_id'); $session_date = Input::get('date_of_session'); $session_db_date = date("Y-m-d", strtotime($session_date)); if (UserMod::where('id', $user_id)->where('role', '=', 'Lecturer')->exists() and Module::where('id', $module_id)->where('module_leader', $user_id)->exists() and Activity::where('id', $act_id)->where('module_id', $module_id)->exists() and $act_id === $activity_id) { ActSession::create(array('activity_id' => Input::get('activity_id'), 'title' => Input::get('title'), 'date_of_session' => $session_db_date, 'start_time' => Input::get('start_time'), 'end_time' => Input::get('end_time'), 'location' => Input::get('location'))); Session::flash('session_success', "Session was successfully created"); return back()->withInput(); } else { Session::flash('failed', "Something went wrong, please try again!"); return back()->withInput(); } }
public function addSession($user_id) { if (UserMod::where('id', $user_id)->where('role', '=', 'Administrator')->exists()) { $session_date = Input::get('date_of_session'); $session_db_date = date("Y-m-d", strtotime($session_date)); ActSession::create(array('title' => Input::get('title'), 'activity_id' => Input::get('activity_id'), 'date_of_session' => $session_db_date, 'start_time' => Input::get('start_time'), 'end_time' => Input::get('end_time'), 'location' => Input::get('location'))); Session::flash('session_success', "Session was successfully created"); return back()->withInput(); } else { Session::flash('failed', "Something went wrong, please try again!"); return back()->withInput(); } }