diff --git a/app/Http/Controllers/Api/CalculatorController.php b/app/Http/Controllers/Api/CalculatorController.php index 951c95f..74bee83 100644 --- a/app/Http/Controllers/Api/CalculatorController.php +++ b/app/Http/Controllers/Api/CalculatorController.php @@ -35,14 +35,23 @@ class CalculatorController extends Controller return $carry; }, []); $result = collect($filteredDirectionIds) - ->filter(fn ($subjectTypes) => !array_diff($subjectTypes[1], $calcultatorSubjects)) + ->filter(function ($subjectTypes) use ($calcultatorSubjects) { + $requiredSbjects = $subjectTypes[1]; + return array_reduce($requiredSbjects, function ($acc, $requiredSbject) use ($calcultatorSubjects) { + if (!in_array($requiredSbject, $calcultatorSubjects)) { + return false; + } + return $acc; + }, true); + + }) ->filter(function ($subjectTypes) use ($calcultatorSubjects) { $optionalSubjectsInCalculator = collect($subjectTypes[2]) ->filter(fn ($optionalSubject) => in_array($optionalSubject, $calcultatorSubjects)); return $optionalSubjectsInCalculator->count() !== 0; })->map(fn ($subjectTypes, $directionId) => $directionId) ; -// dd($result); + dd($result); $directions = Direction::whereIn('id', $result)->get(); diff --git a/resources/views/new-design/bakalavr-special.blade.php b/resources/views/new-design/bakalavr-special.blade.php index 98c42bb..a46c7aa 100644 --- a/resources/views/new-design/bakalavr-special.blade.php +++ b/resources/views/new-design/bakalavr-special.blade.php @@ -1,4 +1,3 @@ - @extends('layouts.new-design-layout') @section('content') -
-
-
-
- -
-
+
-
+
-
+
-
+
ПЕРЕЧЕНЬ ФАКУЛЬТЕТОВ
@@ -328,17 +366,22 @@
- -