input()['predmets']; $getsSubjects = json_decode($getJSON); $countUserSubjects = count($getsSubjects); $filteredDirectionIds = EntranceExamination::all() ->select("direction_id", "subject_id") ->groupBy('direction_id') ->map(function ($direction) { return $direction->map(fn($item) => $item['subject_id']); }) ->filter(fn($direction) => count($direction) <= $countUserSubjects)->keys(); $directions = Direction::whereIn('id', $filteredDirectionIds)->get(); $generateHtml = function ($acc, $direction) { $department = Department::find($direction->department_id); $faculty = Faculty::find($department->faculty_id); // phpcs:disable return "{$acc}
{$direction->description}