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} {$faculty->name} id}{$direction->id }\" aria-controls=\"offcanvasScrolling\" role=\"button\">{$direction->name}
id }{$direction->id }\" aria-labelledby=\"offcanvasScrollingLabel-{$direction->id}{$direction->id }\" style=\"height: 100%; font-family: Geologica-Medium;overflow-y: auto ;\">
{$direction->code}
{$direction->name}


Уровень образования: {$direction->educationLevel->name}
Форма обучения: {$direction->educationForm->name}


Бюджетные места: {$direction->budget_places}
Квота: {$direction->quota}


Места на контракт: {$direction->paid_places}
Стоимость платного обучения: {$direction->cost_paid_place}


Период обучения (в годах): {$direction->period}

{$direction->description}

{$direction->period} "; }; // phpcs:enable $html = $directions->reduce($generateHtml, ''); return response()->json(['html' => $html]); } }