public function modifyActivities($user_id, $id) { $user = UserMod::where('id', $user_id)->where('role', '=', 'Administrator')->first(); if (UserMod::where('id', $user_id)->where('role', '=', 'Administrator')->exists()) { Session::flash('no_module', "No module information existed in our records for this activity"); $module = Module::get(); $activity = Activity::with('module')->find($id); $sessions = ActSession::where('activity_id', $id)->get(); return View::make("Admin-activities-edit")->with('activity', $activity)->with('module', $module)->with('user', $user)->with('sessions', $sessions); } else { Session::flash('failed', "Something went wrong, please try again!"); return back()->withInput(); } }