function save_instructor(Request $request) { $acam = Session::get('phaseterm'); $instructor = $request->instructor; $class_id = $request->cl_id; // no point if the instructor = 0 if ($instructor != 0) { $time = Time::getPeriod($class_id); $day = Day::getShortDay($class_id); $conflict = Api::checkInstructor($instructor, $time, $day); if ($conflict == false) { $class = Classallocation::find($class_id); $class->instructor = $instructor; $class->save(); if ($request->ajax == 0) { Session::flashdata('message', htmlAlert('Successfully Assigned', 'success')); return back(); } } else { if ($request->ajax == 0) { Session::flashdata('message', htmlAlert('Conflict')); return back(); } else { echo 'conflict'; } } } else { if ($request->ajax == 0) { Session::flashdata('message', htmlAlert('Please Select a instructor')); return back(); } else { echo 'no'; } } }