applicant-site/app/Http/Controllers/admin/PageController.php

44 lines
1.3 KiB
PHP

<?php
namespace App\Http\Controllers\admin;
use App\Enums\ExaminationTypeEnum;
use App\Http\Controllers\Controller;
use App\Models\Admission;
use App\Models\EntranceExamination;
use App\Models\Faculty;
use App\Models\Subject;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Illuminate\Foundation\Application;
class PageController extends Controller
{
public function index(): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
$admissions = Admission::all()->sortBy('position');
return view('menu.reception-screen', compact('admissions'));
}
public function directions()
{
$faculties = Faculty::all();
$subjects = EntranceExamination::all()
->select('subject_id', 'subject_type_id', 'examination_type_id')
->where('examination_type_id', '=', ExaminationTypeEnum::Ege->value)
->reduce(function (?array $carry, $subject) {
$id = $subject['subject_id'];
$value = Subject::find($id)->name;
$carry[$id] = $value;
return $carry;
});
return view('new-design.bakalavr-special', compact('faculties', 'subjects'));
}
public function calculator($request)
{
return response()->json($request);
}
}