sortBy('position'); return view('menu.reception-screen', compact('admissions')); } public function directions() { // $directions = DB::table('faculties') // ->join('departments', 'faculties.id', '=', 'departments.faculty_id') // ->join('directions', 'departments.id', '=', 'directions.department_id') // ->select('faculties.name as faculties.name', 'directions.name', 'directions.id') // ->groupBy('faculties.name') // ->get(); $faculties = Faculty::all(); $subjects = EntranceExamination::all() ->select('subject_id', 'subject_type_id', 'examination_type_id') ->where('examination_type_id', '=', ExaminationTypeEnum::Ege->value) ->groupBy('subject_type_id')->map(function ($examinate) { return $examinate->reduce(function (?array $carry, $subject) { $id = $subject['subject_id']; $value = Subject::find($id)->name; $carry[$id] = $value; return $carry; }); }) ->toArray(); dd($subjects); // $subjects = EntranceExamination::pluck('name', 'id'); // $infBez = $faculties->find(FacultyEnum::InfBez->value); // $query = `select faculties.name, directions.name, directions.id //FROM faculties //join departments on faculties.id = departments.faculty_id //join directions on departments.id = directions.department_id`; // $directions = DB::($query); // foreach ($faculties as $faculty) { // foreach ($faculty->departments as $department) { // foreach ($department->directions as $direction) { // // } // } // // } return view('new-design.bakalavr-special', compact('faculties', 'subjects')); } public function calculator($request) { return response()->json($request); } }