diff --git a/app/Http/Controllers/Api/CalculatorController.php b/app/Http/Controllers/Api/CalculatorController.php index 23c8963..9d850b9 100644 --- a/app/Http/Controllers/Api/CalculatorController.php +++ b/app/Http/Controllers/Api/CalculatorController.php @@ -8,6 +8,8 @@ use App\Models\Department; use App\Models\Direction; use App\Models\EntranceExamination; use App\Models\Faculty; +use App\Models\Subject; +use App\Services\DirectonHtmlBuilder; use Illuminate\Http\Request; use Illuminate\Support\Facades\URL; @@ -34,7 +36,7 @@ class CalculatorController extends Controller return $carry; }, []); - $result = collect($filteredDirectionIds) + $directionIds = collect($filteredDirectionIds) ->filter(function ($subjectTypes) use ($calcultatorSubjects) { $requiredSubjects = $subjectTypes[1]; return array_reduce($requiredSubjects, function ($acc, $requiredSubjects) use ($calcultatorSubjects) { @@ -51,97 +53,147 @@ class CalculatorController extends Controller return $optionalSubjectsInCalculator->count() !== 0; } return true; - })->map(fn($subjectTypes, $directionId) => $directionId); - - $directions = Direction::whereIn('id', $result)->get(); - + }) + ->map(fn($subjectTypes, $directionId) => $directionId); + $directions = Direction::whereIn('id', $directionIds)->get(); +// dd($directionIds); + $dataToGenerateHTML = $this->getDirectionsToModals($directionIds); +// dd($dataToGenerateHTML); $generateHtml = function ($acc, $direction) { - $department = Department::find($direction->department_id); - $faculty = Faculty::find($department->faculty_id); - // phpcs:disable - $fon_3 = URL::to('img/front-page/bakalavr-special/fon3_blok.png'); - return "{$acc}
{$direction->description}
-{$direction['description']}
+Бюджет
+ +Коммерция
+