public function UpdateInfoPage(Request $request) { $user = \Auth::user(); $id = $user->id; $email = $request->get('email'); $phone = $request->get('phone'); $c261 = $request->get('261'); $c262 = $request->get('262'); $c306 = $request->get('306'); $c406 = $request->get('406'); $python = $request->get('python_slide'); $java = $request->get('java_slide'); $c = $request->get('c_slide'); $pref = $request->get('team-style'); $std = User::find($id); $std->email = $email; $std->phoneNo = $phone; $std->save(); $preferences = student_preferences::find($id); $preferences->python = $python; $preferences->java = $java; $preferences->c = $c; $preferences->teamStyle = $pref; $preferences->save(); $classes = \DB::select(\DB::raw('(SELECT * FROM student_classes WHERE id = ' . $id . ')')); if (count($classes) > 0) { foreach ($classes as $c) { $class = student_classes::find($c->id); if ($class != null) { $class->delete(); } } } if ($c261 == 'on') { student_classes::create(['id' => $id, 'classID' => 1]); } if ($c262 == 'on') { student_classes::create(['id' => $id, 'classID' => 2]); } if ($c306 == 'on') { student_classes::create(['id' => $id, 'classID' => 3]); } if ($c406 == 'on') { student_classes::create(['id' => $id, 'classID' => 4]); } return redirect('home'); }
public function studentInfo() { $user = \Auth::user(); $classes = student_classes::where('id', '=', $user->id)->get(array('classID')); $pref = student_preferences::where('id', '=', $user->id)->get(); return view('student\\studentInfo', compact('user', 'classes', 'pref')); }
public function run() { DB::table('student_preferences')->delete(); student_preferences::create(['id' => '1', 'python' => '1', 'java' => '1', 'c' => '9', 'teamstyle' => '2']); student_preferences::create(['id' => '2', 'python' => '1', 'java' => '1', 'c' => '9', 'teamstyle' => '1']); student_preferences::create(['id' => '3', 'python' => '1', 'java' => '9', 'c' => '1', 'teamstyle' => '3']); student_preferences::create(['id' => '4', 'python' => '1', 'java' => '9', 'c' => '1', 'teamstyle' => '2']); student_preferences::create(['id' => '5', 'python' => '9', 'java' => '1', 'c' => '1', 'teamstyle' => '1']); student_preferences::create(['id' => '6', 'python' => '9', 'java' => '1', 'c' => '1', 'teamstyle' => '3']); student_preferences::create(['id' => '7', 'python' => '5', 'java' => '1', 'c' => '1', 'teamstyle' => '2']); student_preferences::create(['id' => '8', 'python' => '5', 'java' => '1', 'c' => '1', 'teamstyle' => '1']); student_preferences::create(['id' => '9', 'python' => '4', 'java' => '4', 'c' => '4', 'teamstyle' => '3']); student_preferences::create(['id' => '10', 'python' => '4', 'java' => '4', 'c' => '4', 'teamstyle' => '2']); student_preferences::create(['id' => '11', 'python' => '4', 'java' => '4', 'c' => '4', 'teamstyle' => '1']); student_preferences::create(['id' => '12', 'python' => '4', 'java' => '4', 'c' => '4', 'teamstyle' => '3']); student_preferences::create(['id' => '13', 'python' => '4', 'java' => '4', 'c' => '4', 'teamstyle' => '2']); student_preferences::create(['id' => '14', 'python' => '4', 'java' => '4', 'c' => '4', 'teamstyle' => '1']); student_preferences::create(['id' => '15', 'python' => '4', 'java' => '4', 'c' => '4', 'teamstyle' => '3']); student_preferences::create(['id' => '16', 'python' => '4', 'java' => '4', 'c' => '4', 'teamstyle' => '2']); student_preferences::create(['id' => '17', 'python' => '4', 'java' => '4', 'c' => '4', 'teamstyle' => '1']); student_preferences::create(['id' => '18', 'python' => '4', 'java' => '4', 'c' => '4', 'teamstyle' => '3']); student_preferences::create(['id' => '19', 'python' => '4', 'java' => '4', 'c' => '4', 'teamstyle' => '2']); student_preferences::create(['id' => '20', 'python' => '4', 'java' => '4', 'c' => '4', 'teamstyle' => '1']); student_preferences::create(['id' => '21', 'python' => '4', 'java' => '4', 'c' => '4', 'teamstyle' => '3']); student_preferences::create(['id' => '22', 'python' => '4', 'java' => '4', 'c' => '4', 'teamstyle' => '2']); student_preferences::create(['id' => '23', 'python' => '4', 'java' => '4', 'c' => '4', 'teamstyle' => '1']); student_preferences::create(['id' => '24', 'python' => '4', 'java' => '4', 'c' => '4', 'teamstyle' => '3']); student_preferences::create(['id' => '25', 'python' => '4', 'java' => '4', 'c' => '4', 'teamstyle' => '2']); student_preferences::create(['id' => '26', 'python' => '4', 'java' => '4', 'c' => '4', 'teamstyle' => '1']); student_preferences::create(['id' => '27', 'python' => '4', 'java' => '4', 'c' => '4', 'teamstyle' => '3']); student_preferences::create(['id' => '28', 'python' => '4', 'java' => '4', 'c' => '4', 'teamstyle' => '2']); student_preferences::create(['id' => '29', 'python' => '4', 'java' => '4', 'c' => '4', 'teamstyle' => '1']); student_preferences::create(['id' => '30', 'python' => '4', 'java' => '4', 'c' => '4', 'teamstyle' => '3']); student_preferences::create(['id' => '31', 'python' => '4', 'java' => '4', 'c' => '4', 'teamstyle' => '2']); student_preferences::create(['id' => '32', 'python' => '4', 'java' => '4', 'c' => '4', 'teamstyle' => '1']); student_preferences::create(['id' => '33', 'python' => '4', 'java' => '4', 'c' => '4', 'teamstyle' => '3']); student_preferences::create(['id' => '34', 'python' => '4', 'java' => '4', 'c' => '4', 'teamstyle' => '2']); student_preferences::create(['id' => '35', 'python' => '4', 'java' => '4', 'c' => '4', 'teamstyle' => '1']); student_preferences::create(['id' => '36', 'python' => '4', 'java' => '4', 'c' => '4', 'teamstyle' => '3']); student_preferences::create(['id' => '37', 'python' => '4', 'java' => '4', 'c' => '4', 'teamstyle' => '2']); student_preferences::create(['id' => '38', 'python' => '4', 'java' => '4', 'c' => '4', 'teamstyle' => '1']); }