public function DeleteModuleActSession($user_id, $module_id, $act_id, $sess_id) { 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 ActSession::where('id', $sess_id)->where('activity_id', $act_id)->exists()) { $Session = ActSession::where('id', $sess_id)->where('activity_id', $act_id); $Session->delete(); Session::flash('success', "Session was successfully deleted"); return redirect('Lecturer/' . $user_id . '/Modules/mod' . $module_id . '/Act' . $act_id); } else { Session::flash('failed', "Something went wrong!, please try again or contact Technical Support"); return back()->withInput(); } }
public function deleteSession($user_id, $id) { if (UserMod::where('id', $user_id)->where('role', '=', 'Administrator')->exists()) { $session = ActSession::where('id', $id); $session->delete(); Session::flash('session_deleted', "Session was successfully deleted"); return redirect('Admin/Activities/Sessions'); } else { Session::flash('failed', "Something went wrong, please try again!"); return back()->withInput(); } }