public function show($student_id) { $student = Student::with(['classrooms', 'registration', 'registration.type', 'department', 'subjects'])->select('students.*')->joinTermName()->findOrFail($student_id); $grades = StudentGrade::with('semester', 'subject')->inCurrentSemester()->where('student_id', $student->id)->get(); $registration = $student->registration; //$study_plan = getspecialtystruct(1); if ($student->department->spec_id) { $study_plan = getspecialtystruct($student->department->spec_id); } else { $study_plan = getspecialtystruct(2); } //dd($study_plan); $departments = Department::select(\DB::raw('GROUP_CONCAT(subject_ids) as sid , id as name'))->where('spec_id', 1)->get()->toArray(); $departments_subjects; foreach ($departments as $key => &$aa) { $a = implode(',', array_unique(array_merge(json_decode(str_replace('],[', ',', $aa['sid']), TRUE)))); $departments_subjects = explode(',', $a); } $student_subjects = StudentSubject::select(\DB::raw('GROUP_CONCAT(subject_id) as sid'))->where('student_id', $student_id)->where('state', 'success')->get()->toArray(); $student_subject_ids = explode(',', $student_subjects[0]['sid']); $result = array_diff($departments_subjects, $student_subject_ids); $complete_deplome_subjects = empty($result); return view('students::students.show', compact('student', 'registration', 'grades', 'study_plan', 'study_subject', 'state_complite_sub', 'complete_deplome_subjects')); }
public function showstruct($specialty) { $specialty_id = $specialty->id; $departments = getspecialtystruct($specialty_id); return view('academystructure::specialties.showstruct', compact('departments')); }