forked from aslan/applicant-site
59 lines
2.0 KiB
PHP
59 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\admin;
|
|
|
|
use App\Enums\ExaminationTypeEnum;
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Admission;
|
|
use App\Models\Direction;
|
|
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;
|
|
});
|
|
$directionsWithInstitution = Direction::with(['department'])
|
|
->join('departments', 'directions.department_id', '=', 'departments.id')
|
|
->join('faculties', 'departments.faculty_id', '=', 'faculties.id')
|
|
->join(
|
|
'educational_institutions',
|
|
'faculties.educational_institution_id',
|
|
'=',
|
|
'educational_institutions.id'
|
|
)
|
|
->get([
|
|
'directions.id',
|
|
'directions.name',
|
|
"educational_institutions.name as educational_institution_name"
|
|
]);
|
|
return view('new-design.bakalavr-special', compact('faculties', 'subjects', 'directionsWithInstitution'));
|
|
}
|
|
|
|
|
|
public function calculator($request)
|
|
{
|
|
return response()->json($request);
|
|
}
|
|
}
|