Пример #1
0
    public function create($student_id)
    {
        $semesters = Semester::select(\DB::raw('CONCAT(academycycle_semesters.name , "-", academycycle_years.name) as name ,
		 academycycle_semesters.id as id'))->join('academycycle_years', 'academycycle_years.id', '=', 'academycycle_semesters.academycycle_year_id')->pluck('name', 'id')->toArray();
        $subjects = Subject::all()->pluck('name', 'id')->toArray();
        return view('students::subjects.create', compact('student_id', 'subjects', 'semesters'));
    }
Пример #2
0
 /**
  * @desc show list of department and its parent sequence and subject per year
  * @param Term $term int to load terms 
  * @param Department $department to load parent_deparment_sequence	
  * @param Department $department to load list of subject append them to its department object
  * @param Faculty $faculty for breadcrumbs
  **/
 public function index(Term $term, Department $department, Faculty $faculty, Subject $subject)
 {
     $departments = $department->menu()->with('parent_department')->where('term_id', '=', $term->id)->get();
     $subjects = $subject->all();
     foreach ($departments as &$department) {
         $department->subjects = $subjects->filter(function ($subject) use($department) {
             return in_array($subject->id, json_decode($department->subject_ids, TRUE));
         });
     }
     $breadcrumbs = $faculty->breadcrumbs()->where('at.id', '=', $term->id)->first();
     return view('academystructure::departments.index', compact('departments', 'term', 'breadcrumbs'));
 }
Пример #3
0
 function getspecialtystruct($specialty_id = 0)
 {
     $departments = \Modules\Academystructure\Entities\Department::menu()->where('as.id', $specialty_id)->orderBy('af.id')->orderBy('ay.id')->orderBy('at.id')->get();
     $subjects = \Modules\Subject\Entities\Subject::all();
     foreach ($departments as &$department) {
         $department->subjects = $subjects->filter(function ($subject) use($department) {
             $subject_ids = json_decode($department->subject_ids, TRUE);
             return is_array($subject_ids) and in_array($subject->id, $subject_ids);
         });
     }
     return $departments;
 }
Пример #4
0
 /**
  * @desc show list of department and its parent sequence and subject per year
  * @param Term $term int to load terms
  * @param Department $department to load parent_deparment_sequence
  * @param Department $department to load list of subject append them to its department object
  * @param Faculty $faculty for breadcrumbs
  **/
 public function index(Term $term, Department $department, Faculty $faculty, Subject $subject)
 {
     $departments = $department->menu()->selectRaw('COUNT(sh.id) as total_students')->Leftjoin('student_histories as sh', 'sh.academystructure_department_id', '=', 'academystructure_departments.id')->with('parent_department')->where('term_id', '=', $term->id)->groupBy('sid')->get();
     $subjects = $subject->all();
     foreach ($departments as &$department) {
         $department->subjects = $subjects->filter(function ($subject) use($department) {
             $subject_ids = json_decode($department->subject_ids, TRUE);
             return is_array($subject_ids) and in_array($subject->id, $subject_ids);
         });
     }
     $breadcrumbs = $faculty->breadcrumbs()->where('at.id', '=', $term->id)->first()->toArray();
     return view('academystructure::departments.index', compact('departments', 'term', 'breadcrumbs'));
 }