public function AddSetSuject() { $exam_type = count(Input::get('exam_type')); $subject_type = SubjectType::where('subject_id', Input::get('subject'))->first(); $subsubjects = SubSubject::where('status', 'Active')->get(); if ($subject_type == "") { if ($exam_type > 0) { for ($i = 0; $i < $exam_type; $i++) { $exam = new SubjectType(); $exam->subject_id = Input::get('subject2'); $exam->sub_subject_id = Input::get('exam_type')[$i]; $exam->save(); } return redirect()->action('Deskpad\\PartnerController@partners')->with('message', 'Exam type added'); } } else { if ($subject_type->subject_id == Input::get('subject')) { return redirect()->action('Deskpad\\PartnerController@partners')->with('message', 'Exam type added'); } else { if ($exam_type > 0) { for ($i = 0; $i < $exam_type; $i++) { $exam = new SubjectType(); $exam->subject_id = Input::get('subject2'); $exam->sub_subject_id = Input::get('exam_type')[$i]; $exam->save(); } return redirect()->action('Deskpad\\PartnerController@partners')->with('message', 'Exam type added'); } } } }
public function getExamType() { $id = Input::get('id'); $subject = SubjectType::where('subject_id', $id)->with('sub_subject')->get(); return Response::json($subject, 200, array(), JSON_PRETTY_PRINT); }